Set control Background color using Dynamic Resource in WPF?

前端 未结 3 891
旧时难觅i
旧时难觅i 2020-12-03 10:29

This is my XAML


            

3条回答
  •  渐次进展
    2020-12-03 10:53

    A2: no. To do what you are doing, it is better to use data binding. Have a property in your viewmodel indicating whether it's 'loaded', then bind the background to it with a suitable converter, or use a trigger. (If it's actually UI that is loading, add the property to the window.) Dynamic resources are used for theming and with templates, in the rare cases when a StaticResource lookup happens too early.

提交回复
热议问题