我试图在XAML中为WPF Window
设置Style
。我可以在VS Designer中看到我的更改,但是当我运行该应用程序时,它始终会获得默认的Style
。为什么WPF窗口总是得到默认样式?
不工作:
<Style TargetType="Window">
<Setter Property="Background" Value="Red"/>
</Style>
如果我给那个Style
密钥和应用该Style
到Window
然后它工作。
工作:
<Style x:Key="window" TargetType="Window">
<Setter Property="Background" Value="Red"/>
</Style>
有任何理由需要给Style
与Window
关键?
任何人都可以请解释发生了什么?
,它是如何从不同什么OP张贴在他的问题? – Nitesh