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

后端 未结 8 2144
长情又很酷
长情又很酷 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:42

    Set the x:Name property in your XAML to what you want to refer to the rectangle as in your c# code. Then, you can access all of the properties of the rectangle in code, such as whateverYouNamedIt.Fill

提交回复
热议问题