-
Notifications
You must be signed in to change notification settings - Fork 667
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
[Preview 4] x:Bind does not work in a custom MenuFlyoutItem #4179
Comments
@lhak Same question here, do you know if this is a preview 4 regression from preview 3? |
I could not test the actual code in the application with preview 3 due to a bug that has now been fixed. However, the repro code above shows that this issue is also present in preview 3. |
Unfortunately I'm not able to repro. As I move the slider the TextBlock stays up to date. |
@MikeHillberg It seems that this issue only occurs if there is another UI element on that page that also uses x:Bind (content is a string property of the page): <Button Content="{Binding content}">
<Button.Flyout>
<MenuFlyout>
<local:MenuFlyoutCustomItem >
<local:MenuFlyoutCustomItem.Template>
<ControlTemplate TargetType="local:MenuFlyoutCustomItem">
<StackPanel Orientation="Horizontal">
<Slider Minimum="0" Maximum="100" Width="150" Value="{x:Bind Value, Mode=TwoWay}" />
<TextBlock Text="{x:Bind Value, Mode=OneWay}"/>
</StackPanel>
</ControlTemplate>
</local:MenuFlyoutCustomItem.Template>
</local:MenuFlyoutCustomItem>
</MenuFlyout>
</Button.Flyout>
</Button> If Binding is changed to x:Bind in the first line, the TextBlock will be empty. Same code works fine in a non-winui 3 UWP project. |
@RealTommyKlein could you confirm if this is expected behavior? |
Thanks for the report - this will be fixed in the Project Reunion 0.8 release. This is caused by using x:Bind in a ControlTemplate when x:Bind is also used in the parent namescope. As a workaround, you can isolate the ControlTemplate in its own ResourceDictionary file that also has its own code-behind (you can use the "Blank Page (WinUI)" template and change the base classes to be New
In Then modify your original .xaml to create an instance of the new
|
Hi @lhak, you should see a fix for this bug in the upcoming WinUI 3/Project Reunion 0.8 Preview, which you can expect soon. Thanks for filing this! |
Can confirm that this is fixed in 0.8. Thanks! |
Describe the bug
x:Bind does not work in a custom MenuFlyoutItem in winui 3, preview 4 while it does work in XAML islands
Steps to reproduce the bug
Steps to reproduce the behavior:
Expected behavior
Works like in XAML islands + .net core 3.1
Screenshots
Version Info
NuGet package version:
[Microsoft.WinUI 3.0.0-preview4.210210.4]
Windows app type:
Additional context
The text was updated successfully, but these errors were encountered: