VS2008中破碎的Silverlight设计图面

VS2008中破碎的Silverlight设计图面,silverlight,namespaces,app.xaml,design-surface,Silverlight,Namespaces,App.xaml,Design Surface,在VisualStudio 2008中,设计图面是空的,因为我将此样式添加到App.xaml中: <Style x:Key="RightAlignedCell" TargetType="data:DataGridCell"> <Style.Setters> <Setter Property="HorizontalContentAlignment" Value="Right" /> </Sty

在VisualStudio 2008中,设计图面是空的,因为我将此样式添加到App.xaml中:

    <Style x:Key="RightAlignedCell" TargetType="data:DataGridCell">
        <Style.Setters>
            <Setter Property="HorizontalContentAlignment" Value="Right" />
        </Style.Setters>
    </Style>
运行Silverlight应用程序时,一切正常。但是,设计图面为空,我在编辑xaml时出现以下错误:

无效的属性值 数据:属性的DataGridCell 目标型

如前所述,这个错误只是在设计时发生的。汇编工作非常完美。我做错了什么,为什么设计者不能正确解析这个名称空间


更新:同样,当我将样式从App.xaml移动到Page.xaml时,设计器再次工作。。有什么想法吗?

你试过这个吗

<Style x:Key="RightAlignedCell" TargetType="{x:Type data:DataGridCell}">
    <Style.Setters>
        <Setter Property="HorizontalContentAlignment" Value="Right" />
    </Style.Setters>
</Style>

根据MS silverlight常见问题解答,这似乎是一个已知的错误,无法修复。

将xmlns声明移动到资源字典。这样地: ...


可以在这里找到示例:blog.andrew veresov.com/post/Silverlight-20-use-of-the-converters-from-external-assembly-in-appxaml.aspx

这会导致属性TargetType的无效属性值{x:Type data:DataGridCell}出错。
<Style x:Key="RightAlignedCell" TargetType="{x:Type data:DataGridCell}">
    <Style.Setters>
        <Setter Property="HorizontalContentAlignment" Value="Right" />
    </Style.Setters>
</Style>