这是 App.xaml 文件:
<Application>
<Application.Resources>
<ResourceDictionary>
<Style TargetType="Window">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
我也有MainWindow.xaml。 在VS的设计模式下查看时,背景确实是灰色的,就像应该的一样。 但是,在应用程序运行时,窗口的背景是默认的白色。
为什么会这样呢?
如何修复这个问题? 我想让所有窗口默认具有标准背景。