Okay here is a softball beginner WPF question.
By default the background of the window is white. I'm trying to hack in an error reporting form and I want to emulate the more standard windows look and feel.
Any easy way to grab the default color for the background?
Click the C1ColorPicker control once to select it. Navigate to the Properties window, and click the Background drop-down arrow, and choose Red or another color in the color picker.
When a Window is created at run-time using the Window object, it is not visible by default. To make it visible, we can use Show or ShowDialog method. Show method of Window class is responsible for displaying a window.
XAML Islands is a technology that enables Windows developers to use new pieces of UI from the Universal Windows Platform (UWP) on their existing Win32 Applications, including Windows Forms and WPF technologies.
Using the SystemColors class and specifically the WindowColor property. When using xaml it is better to use DynamicResources and therefore use the ...Key properties. That way your application changes in the fly when the user changes the color in Windows.
<Window>
<Window.Background>
<SolidColorBrush Color="{DynamicResource {x:Static SystemColors.WindowColorKey}}">
</SolidColorBrush>
</Window.Background>
</Window>
Using the ...BrushKey properties makes it easier to use when in need of a brush
<Window Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
</Window>
PS: WPF Windows should already have the correct color by default
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With