Custom WPF Binding

前端 未结 3 805
离开以前
离开以前 2021-01-21 02:55

I have a custom MarkupExtension that simulates binding. It works well in normal assignments but when used in Style Setters, for example:



        
3条回答
  •  鱼传尺愫
    2021-01-21 03:25

    why don't you

    return Value
    

    inside the ProvideValue??

    else

    You can bind to only DependencyProperty. make a dependency property for Value in your MyExtension Class!

    public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(Object), typeof(MyContentControl), new UIPropertyMetadata());
    

提交回复
热议问题