Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binding inside MenuFlyout inside TemplatedControl does not work the first time #17687

Open
Trueber opened this issue Dec 4, 2024 · 1 comment
Labels

Comments

@Trueber
Copy link

Trueber commented Dec 4, 2024

Describe the bug

On our project, we use a MenuFlyout on a Button in a TemplatedControl that is dynamically modified based on another binding property.
The first time the button is pressed on each TemplatedControl, the Bindings in he MenuFlyout are not bound correctly. After the second time each button is pressed, everything works as expected.

First time:
Screenshot from 2024-12-04 08-51-06

Second time:
Screenshot from 2024-12-04 08-53-49

To Reproduce

https://github.com/Trueber/template-binding-isse/blob/master/TemplatedControlBindingIssue/Controls/TemplatedControl1.axaml

 <Button >
        <avalonia:MaterialIcon Foreground="Gray" Kind="Menu" MinHeight="48" MinWidth="48" />
        <Button.Flyout>
            <MenuFlyout>
                <MenuItem
                    IsVisible="{TemplateBinding MenuItem1Visible}"
                    Header="{TemplateBinding Header1}"
                    Command="{TemplateBinding MenuItem1}"
                    CommandParameter="{TemplateBinding State}">
                </MenuItem>
                <MenuItem
                    IsVisible="{TemplateBinding MenuItem2Visible}"
                    Header="{TemplateBinding Header2}"
                    Command="{TemplateBinding MenuItem2}"
                    CommandParameter="{TemplateBinding State}">
                </MenuItem>
           </MenuFlyout>
         </Button.Flyout>
</Button>

Expected behavior

The Bindings already work on the first time each button is pressed.

Avalonia version

11.x.x

OS

Windows, Linux

Additional context

No response

@Trueber Trueber added the bug label Dec 4, 2024
@alextim
Copy link

alextim commented Dec 9, 2024

Has the same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants