How do you color a rectangle in C# that has been declared in XAML in WPF?

后端 未结 8 2138
长情又很酷
长情又很酷 2020-12-20 11:26

How do you color a rectangle in C# that has been declared in XAML in WPF?

There is a rectangle control in XAML. In my C# code there are times in which it would be n

8条回答
  •  半阙折子戏
    2020-12-20 11:50

    For all the lazy programmers, the .net color enums:

    myRectangle.Fill = new SolidColorBrush(System.Windows.Media.Colors.AliceBlue); 
    

提交回复
热议问题