Order that DependencyProperties bindings are evaluated?

前端 未结 2 2337
长发绾君心
长发绾君心 2021-02-20 07:03

What determines the order that multiple DepdencyProperties on the same control get evaluated in?

I am using the Extended WPF Toolkit PropertyGrid and have both SelectedO

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-20 07:34

    The short answer is that it is all a black box and you should not rely on one being evaluated before or after another. So the best approach would be to modify the PropertyGrid so it works regardless of the order the properties are set.

    The long answer is it looks like it depends on how the order that the bindings are specified. So you can do:

    
    

    Instead of:

    
    

    Again, it would be bad practice to rely on this. And this quirk may only work for when the control is initialized. Changes to ActiveDataPoint or the DataContext later, may result in a different order.

提交回复
热议问题