我在 ResourceDictionary 中定义我的设置和样式:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:properties="clr-namespace:Kavand.UI.Properties">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<properties:Settings x:Key="settings" />
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="PopupMenu_StackPanel">
<Setter Property="TextBlock.FontSize" Value="{Binding Source={StaticResource settings}, Path=Default.Font_Menu_Size}" />
<Setter Property="TextBlock.FontFamily" Value="{Binding Source={StaticResource settings}, Path=Default.Font_Menu_Family}" />
<Setter Property="TextBlock.FontWeight" Value="{Binding Source={StaticResource settings}, Path=Default.Font_Menu_Weight}" />
<Style.Resources>
<Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource KavandMenuItem}">
<Style.Triggers>
<Trigger Property="IsChecked" Value="true">
<Setter Property="IsEnabled" Value="false" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="True" />
<Condition Property="IsHighlighted" Value="True" />
</MultiTrigger.Conditions>
<Setter Property="Foreground" Value="{DynamicResource K_Brush_Gray}" />
</MultiTrigger>
</Style.Triggers>
</Style>
</Style.Resources>
</Style>
</ResourceDictionary>
当我运行我的应用程序时,我收到错误:
'无法创建未知类型'{clr-namespace:Kavand.UI.Properties}Settings'。' 行号“6”和行位置“14”。