简体   繁体   中英

How to set the background color of all windows in xaml C#?

Is there an easy way to set the background color of all windows in app.xaml? I hope to set the default background color of windows in app.xaml. Please let me know how to set the background color of all windows in xaml. Thanks in advance.

You can set default styles in App.xaml file like that:

<Application.Resources>
    <Style TargetType="{x:Type Window}">
        <Setter Property="Background" Value="Black" />
    </Style>
</Application.Resources>

TargetType is looking for specific type of element, For example Gird, Button, DockPanel

Property is specifying exact value you want to set

Value is the value itself

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM