错误:“无法创建未知类型‘{clr-namespace:NameSpace.Properties}设置’." [英] Error: 'Cannot create unknown type '{clr-namespace:NameSpace.Properties}Settings'.'
本文介绍了错误:“无法创建未知类型‘{clr-namespace:NameSpace.Properties}设置’."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 ResourceDictionary 中定义了我的设置和样式:
I define my settings and styles in a 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>
当我运行我的应用程序时,出现错误:
When I run my application, I get the error:
'无法创建未知类型'{clr-namespace:Kavand.UI.Properties}设置'.'行号6"和行位置'14'.
'Cannot create unknown type '{clr-namespace:Kavand.UI.Properties}Settings'.' Line number '6' and line position '14'.
推荐答案
我已将文件的构建操作"属性设置为资源".当我将其更改为页面"时,问题就解决了.
I had set the file's "Build Action" property to "Resource". When I changed it to "Page" the problem was resolved.
这篇关于错误:“无法创建未知类型‘{clr-namespace:NameSpace.Properties}设置’."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文