WPF - 使用StaticResource的Visual Studio Xaml intellisense错误

问题描述 投票:2回答:1

我在一个独立于UserControl的文件中有一个ResourceDictionary,名为MyControl.xaml,我正在制作。在我的页面顶部,我说

<UserControl.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/Resources;component/AppDictionary.xaml"/>
        </ResourceDictionary.MergedDictionaries>

        <Style x:Key="MyTextBoxStyle" BasedOn="{StaticResource ThisTextBoxStyle}" TargetType="TextBox">
            <Setter Property="Margin" Value="10,0,10,0"/>
        </Style>

        <Style x:Key="MyLabelStyle" BasedOn="{StaticResource ThisLabelStyle}" TargetType="TextBlock">
            <Setter Property="Margin" Value="10,20,0,0"/>
        </Style>
    </ResourceDictionary>
</UserControl.Resources>

第一个StaticResource被VS看得很好,没有警告/错误。但是,第二个问题是“资源'ThisLabelStyle'无法解决。”但是它编译并运行得很好。两种风格都没有。这只是VS很奇怪吗?

使用VS 2015.我甚至在文件后面使用其他StaticResources,有些没有问题,其他人有相同的错误,据我所知,它们之间没有连接。

wpf xaml visual-studio-2015 intellisense
1个回答
0
投票

尝试删除与解决方案文件位于同一级别的.vs文件夹。这对我来说很有把戏。看来,损坏的智能感知信息以某种方式缓存在那里。

© www.soinside.com 2019 - 2024. All rights reserved.