2021年3月27日星期六

Using Custom Attached Properties with Base Class and Generics

I wish to use AngelSix's custom attached properties Code in a .NET Framework 4.7.2 class library. However, when I try to add an attached property to an object in a Xaml file, what I get from Intellisense in Visual Studio is local:BaseAttachedProperty`2.value and not the desired attached property like local:IsBusyProperty.Value. When I manually type local:IsBusyProperty.Value, the application crashes with the error message The method or operation is not implemented pointing to the attached property. I understand that the `2 means a generic type, with 2 generic parameters - alluding to the Base Class with two generic parameters:

public abstract class BaseAttachedProperty<Parent, Property>          where Parent : new(){}  

But how do I get the correct attached property, that is, classes that implement the base class with generic parameters and not this cryptic local:BaseAttachedProperty`2.value message?

https://stackoverflow.com/questions/66837791/using-custom-attached-properties-with-base-class-and-generics March 28, 2021 at 10:01AM

没有评论:

发表评论