|In my utility WPF library I (reinvented the wheel, yeah yeah, I know..) created a
Behaviors attached property of type
static DependencyPropertyKey BehaviorsKey = DependencyProperty.RegisterAttachedReadOnly(
public static DependencyProperty BehaviorsProperty = BehaviorsKey.DependencyProperty;
public static BehaviorList GetBehaviors(DependencyObject target)
var result = (BehaviorList)target.GetValue(BehaviorsProperty);
if (result == null)
result = new BehaviorList(target);
then I used this property in XAML to add my own custome behavior type:
and here are the class involved
public class BehaviorList : IList<Behavior>, System.Collections.IList
public class DragLayerGroupBehavior : Behavior
This works well and good (at runtime) but the designer has red underlines and show the following errors:
Error XLS0503, A value of type 'DragLayerGroupBehavior' cannot be added to a collection or dictionary of type 'BehaviorList'.
Error XDG0048, The specified value cannot be assigned to the collection. The following type was expected: "Behavior".
So the question is, how to "solve" those errors, i.e. unconfused VisualStudio WPF designer?
Is there a particular interface I need to implement, some attribute to use, or something?