我试图在我的app.xaml中为我的WPF Windows应用程序中的每个窗口设置默认样式.到目前为止,我在app.xaml中有这个:
<Application.Resources>
<ResourceDictionary>
<Style x:Key="WindowStyle" TargetType="{x:Type Window}">
<Setter Property="Background" Value="Blue" />
</Style>
</ResourceDictionary>
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)
通过专门告诉窗口通过以下方式使用此样式,我可以在运行应用程序(但不是VS设计器)时让窗口显示此样式:
Style="{DynamicResource WindowStyle}
Run Code Online (Sandbox Code Playgroud)
这有效,但并不理想.那么我该怎么做:
谢谢!