Binding for WPF Styles

前端 未结 4 1843
刺人心
刺人心 2020-12-07 21:07

I\'m trying to create a custom control - a button - which will have multiple styles applied to it depending on the value of a property within the data context.

What

4条回答
  •  心在旅途
    2020-12-07 21:21

    It seems that you need to use DataTrigger class. It allows you to apply different styles to your button based on it's content.

    For example following style will change button's background property to red based on value of data context object's property

    
    

提交回复
热议问题