You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Attached properies don't work with UserControl (DependencyProperty.RegisterAttached) #3243
Attached properties don't work on UserControl like they work on Control.
Expected behavior
Attached properties work on UserControl like they work on any other Control.
How to reproduce it (as minimally and precisely as possible)
Create an attached property (using DependencyProperty.RegisterAttached).
Create a UserControl.
Use the attached property on the UserControl.
Update the attached property via regular binding.
Notice that the propertyChangedCallback isn't called.
You'll also notice an System.InvalidCastException in BindableMetadata.g.cs if you have the exceptions attached.
Note that using the following workaround doesn't fix the bug:
changed the title [-]AttachedProperies don't work with UserControl[/-][+]Attached properies don't work with UserControl (DependencyProperty.RegisterAttached)[/+]on May 26, 2020
Activity
[-]AttachedProperies don't work with UserControl[/-][+]Attached properies don't work with UserControl (DependencyProperty.RegisterAttached)[/+]jeromelaban commentedon Jun 1, 2020
I'm not able to reproduce this issue with neither 2.1.37 or the latest 3.0 dev bits. Here's the sample I used:
UserControlTest2.zip.
Can you validate that the repro is the one you wanted ?
jeromelaban commentedon Jun 1, 2020
Scratch that. The property is not attached to the proper object, it's attached to the first element of the usercontrol, not the user control itself.
fix(UserControl): Attached properties are now set on UserControl itse…
fix(UserControl): Attached properties are now set on UserControl itse…
fix(UserControl): Attached properties are now set on UserControl itse…
fix(UserControl): Attached properties are now set on UserControl itse…
fix(UserControl): Attached properties are now set on UserControl itse…