【发布时间】:2011-10-05 18:16:09
【问题描述】:
我正在使用 VS2008。我有这门课
[System.Windows.Markup.ContentProperty("Child")]
public class CaptionedBox : Control
{
static CaptionedBox()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(CaptionedBox),
new FrameworkPropertyMetadata(typeof(CaptionedBox)));
}
public static readonly DependencyProperty ShadeVisibilityProperty =
DependencyProperty.Register(
"ShadeVisibility", typeof(Visibility), typeof(CaptionedBox), new
PropertyMetadata(Visibility.Hidden));
}
此代码在 ResourceDictionary 中(在名为 Generic.xaml 的文件中)
<ControlTemplate TargetType="{x:Type wft:CaptionedBox}">
<Grid>
...
<Rectangle Fill="#44000000" Visibility="{TemplateBinding ShadeVisibility}"/>
</Grid>
</ControlTemplate>
没有错误,没有问题,我到处使用这个 CaptionedBox。
我在同一个项目中有另一个 XAML 页面,它使用 Source="../Themes/Generic.xaml" 引用此 ResourceDictionary。当我打开该页面时,它显示“资源字典 XAML 文件有错误,无法加载”。那时它指的是 Generic.XAML。如果我双击错误消息,即使在 VS 2008 中打开了 Generic.XAML,我也会得到一个不同的选项卡,它看起来像一个不同的 Generic.xaml,除了内容相同并且如果我复制每个的完整路径标签,我看到了这个:
C:\Source\LyonsForge\root\PumpServicing\branches\PSRT_1_0_2\Code\Bench\Controls\Wizard..\Themes\Generic.xaml C:\Source\LyonsForge\root\PumpServicing\branches\PSRT_1_0_2\Code\Bench\Controls\Themes\Generic.xaml
虽然有点尴尬,但都是同一条路。
有什么线索吗?
【问题讨论】:
-
我在研究时所做的其他事情:删除了所有 obj 和 bin 文件夹,清理并重建了整个项目,在整个硬盘驱动器中搜索了 Generic.Xaml 的其他实例......重新启动:)跨度>