找不到具有名称/密钥的资源

时间:2016-08-17 09:34:39

标签: xaml uwp-xaml

我有一个UWP应用程序。我执行应用程序时,样式工作没有问题。但不是在设计师。特别是无法加载用户控件。显示的错误消息是:

 Cannot find a Resource with the Name / Key [Name]

当我转到该用户控件时,它主要显示正确。

我用以下方式引用样式:

                   Style="{StaticResource DeemphasizedBodyTextBlockStyle}"

我的Textstyles有一个文件。在该文件中,我的样式定义如下:

<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>

在视图项目的属性中,我添加了一个Designer资源文件(作为页面),其中包含以下内容:

<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>

整个回购都可以在这里找到:https://github.com/MoneyFox/MoneyFox

0 个答案:

没有答案
相关问题