Xaml 找不到具有名称/键的资源
我有一个UWP应用程序。当我执行应用程序时,这些样式可以正常工作。但不是在设计师身上。尤其是无法加载用户控件。显示的错误消息是:Xaml 找不到具有名称/键的资源,xaml,uwp-xaml,Xaml,Uwp Xaml,我有一个UWP应用程序。当我执行应用程序时,这些样式可以正常工作。但不是在设计师身上。尤其是无法加载用户控件。显示的错误消息是: Cannot find a Resource with the Name / Key [Name] 当我转到该用户控件时,它基本上是正确显示的 我引用以下样式: Style="{StaticResource DeemphasizedBodyTextBlockStyle}" 我有一个文本样式文件。在该文件中,我定义了如下样式:
Cannot find a Resource with the Name / Key [Name]
当我转到该用户控件时,它基本上是正确显示的
我引用以下样式:
Style="{StaticResource DeemphasizedBodyTextBlockStyle}"
我有一个文本样式文件。在该文件中,我定义了如下样式:
<Style x:Key="DeemphasizedBodyTextBlockStyle"
TargetType="TextBlock"
BasedOn="{StaticResource BodyTextBlockStyle}">
<Setter Property="FontSize"
Value="12" />
<Setter Property="TextWrapping"
Value="NoWrap" />
<Setter Property="CharacterSpacing"
Value="75" />
<Setter Property="HorizontalAlignment"
Value="Left" />
<Setter Property="VerticalAlignment"
Value="Top" />
<Setter Property="Foreground"
Value="{StaticResource AppForegroundColorSecondary}" />
</Style>
在视图项目的属性中,我添加了一个设计器资源文件(作为页面),其中包含以下内容:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///Style/AppStyles.xaml" />
<ResourceDictionary Source="ms-appx:///Style/ColorsDark.xaml" />
<ResourceDictionary Source="ms-appx:///Style/ColorsLight.xaml" />
<ResourceDictionary Source="ms-appx:///Style/ControlStyles.xaml" />
<ResourceDictionary Source="ms-appx:///Style/TextStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
整个回购协议可在以下位置获得: