-
Notifications
You must be signed in to change notification settings - Fork 674
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
WinUI - TemplateBinding not working for Commands #7003
Comments
{TemplateBinding} only supports binding to a property that's backed by a DependencyProperty, which could be causing this. {Binding} uses reflection and generated code-behind to bind to any WinRT or C# property. |
Did you look at the code? What makes you think it's not binding to a DependencyProperty? |
Dupe of #4546 ? |
Yeah, it's likely. The notes say that someone's having trouble with the repro, so the ZIP file here is an easy way to validate that you have a real bug. |
Sorry, I was looking at the code in the Issue and didn't notice the zip file link. Thanks for the repro. |
May also be related to #2508 in that x:Bind behevior in templates & resource dictionaries is finicky, failing there when:
|
Just started to play with WinUI, I started with 1.2, and I just hit this issue #4546 |
Just stumbled across this exact same issue when creating a very simple CustomControl. Can confirm that this is still a thing in 1. Template binding works properly for all other properties, but for some reason it doesn't work with commands. The mentioned workaround (Replace The solution is simple, but took me a while to find this - and to me this a very annoying bug. Should have a higher priority. Hope this can get fixed soon! |
Any update on this? |
Describe the bug
TemplateBinding to an ICommand property doesn't work in WinUI. However, explicitly binding using the RelativeSource does.
BgLabelControlApp.zip
This doesn't work:
This works:
Steps to reproduce the bug
Expected behavior
One expects TemplateBinding to bind to the templated parent.
Screenshots
No response
NuGet package version
No response
Windows app type
Device form factor
Desktop
Windows version
Windows 11 (21H2): Build 22000
Additional context
No response
The text was updated successfully, but these errors were encountered: