我所看到的大多数WPF样式被拆分成一个非常长的Theme.xaml文件。我想我的分手是为了便于阅读,所以我Theme.xaml看起来是这样的:拆分WPF样式XAML文件
<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;v3.0.0.0;31bf3856ad364e35;component/themes/aero.normalcolor.xaml"/>
<ResourceDictionary Source="Controls/Brushes.xaml"/>
<ResourceDictionary Source="Controls/Buttons.xaml"/>
...
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
的问题是,这种解决方案是行不通的。我有一个默认的按钮样式是支持算法FMP一个按钮的默认Aero的风格:
<Style x:Key="{x:Type Button}" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="FontSize" Value="14"/>
...
</Style>
如果我把所有这一切都在一个文件中,但一旦工程,我把它分解了,我得到的StackOverflow例外,因为它认为它是BasedOn本身。有没有解决的办法?在合并资源字典时,WPF如何添加资源?
我自己的自定义按钮样式适用于任何地方,我不希望每次创建按钮时都必须明确设置按钮样式。我只想调整PresentationFramework.Aero中现有的默认按钮样式 – anon 2010-03-12 17:30:00