我想使用 Aero 文本框样式,但仍会覆盖一些属性。我尝试通过以下方式完成此操作:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/PresentationFramework.Aero, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="Margin" Value="2" />
<Setter Property="Padding" Value="2" />
</Style>
</ResourceDictionary>
但是,这会导致StackOverflowException
启动我的应用程序时出现错误。当我删除对 PresentationFramework.Aero 的引用时,这可行,但我得到了默认的操作系统样式,这使应用程序变得丑陋。;)
因此,实际上:如果我想在所有文本框上覆盖某些样式,我将无法获得 Aero 外观。如果我想要 Aero 外观,我无法覆盖任何样式。僵局。
有什么办法可以解决这个问题?