How can I create a button which Rectangle object filled with a color in WPF with C#?
wpf, wpf-controls
Solution
button.Content = rectangle;
or in XAML that would be like
<Button>
<Button.Content>
<Rectangle Width="100" Height="50">
<Rectangle.Fill>
<SolidColorBrush Color="Aqua" />
</Rectangle.Fill>
</Rectangle>
</Button.Content>
</Button>
Problem
How can I create Button control which contains a Rectangle object filled with the color represented by the Colors.Aqua? I have a rectangle ``` Rectangle rectangle = new Rectangle(); rectangle.Fill = new SolidColorBrush(Colors.Aqua); rectangle.Width = 100; rectangle.Height = 50; ``` and I have a button: ``` Button button = new Button(); button.Content = "Button"; ``` I can't figure out how to combine these things. Any ideas?