KirillOsenkov/PublicBugs

WPF: attached property can't be used in MultiTrigger Condition Property

KirillOsenkov opened this issue · 2 comments

InvalidOperationException: Must have non-null value for 'Property' for multitrigger condition

Needs to be MultiDataTrigger with Condition Binding, not MultiTrigger with Property.
https://stackoverflow.com/questions/21084676/wpf-must-have-non-null-value-for-property-for-multitrigger-condition

Answer from Jan Kucera:

Interesting, I would have never tried to lie to the property system about whose property I am registering. I would argue that the documentation covers this in the ownerType argument of RegisterAttached method: The owner type that is registering the dependency property. It simply is not UIElement in your case.

Any reason why you don’t register it with typeof(ContextMenuUtilities) as the owner? Note that the owner does not affect on which element types you can use the property. I believe you could inherit directly from DependencyObject then, I don’t think I ever had to inherit from anything else solely because of attached properties. (Technically, you don’t even need to be a DependencyObject to declare attached properties if they are not dependency properties.)