我有一个多个项目的解决方案,这些项目一直在构建,没有错误。最近,我发现如果我在编辑器中打开XAMview,清理解决方案然后构建它,我得到一堆"找不到名为' Resource'的资源。资源名称区分大小写。"错误。资源'找不到的内容会在不同的视图中引用,而不是我当前所处的视图。当前视图中的任何静态/动态资源都不会收到错误。如果我关闭视图并重建,则不会出现错误。
我已经完成并确保我的所有命名空间引用都是正确的,资源字典在我的app.xaml中,所有键都在我的样式中首先定义,等等。
知道是什么导致了这个或如何解决它?
查看错误:
<StackPanel>
<StackPanel Orientation="Horizontal">
<amp:AmpView DataContext="{Binding Path=Amp}" />
<autoCal:AutoCalView DataContext="{Binding Path=AutoCal}"
Margin="5 0 0 0" />
</StackPanel>
引用视图:
<Border Style="{StaticResource ContentBorderStyle}"
HorizontalAlignment="Left">
资源:
<!-- Content container styles -->
<Style x:Key="ContentBorderStyle" TargetType="{x:Type Border}">
<Setter Property="Background" Value="{StaticResource ContentBackgroundBrush}" />
<Setter Property="BorderBrush" Value="{StaticResource ContentBorderBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="3" />
<Setter Property="Margin" Value="0 0 0 5" />
<Setter Property="Padding" Value="3" />
</Style>
的App.xaml
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Src.Pl;component/Resources/Styles/StyleResources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>