我正在使用 Material Design in XAML 来为我的 WPF UI 控件添加样式。我在 App.xaml 文件中定义了默认主题。
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
然而,我希望我的某些控件具有默认的WPF外观和感觉,但看起来XAML中的Material Design会覆盖WPF默认的控件样式。
例如:下面的按钮自动从Material design中获取其样式,而不需要指定。
<Button Content="Hello" Width="100"/>
我该如何在某些控件中禁用Material Design主题?
<Button Style="{x:Null}"/>
,然后我认为可能有更好的方法来删除 Material Design 的默认样式。 - Bloggrammer