How do I convert a Color to a Brush in XAML?

前端 未结 7 1949
逝去的感伤
逝去的感伤 2020-11-27 05:52

I want to convert a System.Windows.Media.Color value to a System.Windows.Media.Brush. The color value is databound to a Rectangle object\'s Fill property. The Fill property

7条回答
  •  伪装坚强ぢ
    2020-11-27 06:01

    A Converter is not needed here. You can define a Brush in XAML and use it. It would be better to define the Brush as a Resource so it can be used other places required.

    XAML is as below:

    
        
    
    
    

提交回复
热议问题