Blend Behaviours - can you bind to their properties?

后端 未结 2 478
悲&欢浪女
悲&欢浪女 2021-01-02 19:26

I am currently migrating a number of attached behaviours I have created to Blend Behaviours so that they support drag and drop within Expression Blend. I have noticed that a

2条回答
  •  佛祖请我去吃肉
    2021-01-02 19:47

    Edit: dain is correct you can still bind to the DataContext which is created artificially, how often have you seen people bind to a SolidColorBrush.Color? It also works even though SolidColorBrush inherits from DependencyObject and hence has no DataContext.

    See this blog post on the inheritance context.

    The thing is that since the behaviours are attached, they do not appear in the logical tree and hence would not inherit a DataContext anyway.

提交回复
热议问题