我在wpf中使用Material design。我在运行时更改主题(亮/暗)。
<materialDesign:DialogHost Identifier="RootDialog">
<materialDesign:DialogHost.Resources>
<Style TargetType="materialDesign:Card" BasedOn="{StaticResource {x:Type materialDesign:Card}}">
<Style.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.dark.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Style.Resources>
<Setter Property="Background" Value="{DynamicResource MaterialDesignCardBackground}" />
</Style>
</materialDesign:DialogHost.Resources>
<Grid>
<!--some code-->
</Grid>
</materialDesign:DialogHost>
我想在运行时将资源字典的来源更改为
pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.light.xaml
我该怎么做?