代码之家  ›  专栏  ›  技术社区  ›  driAn

VS2008中破碎的Silverlight设计表面

  •  0
  • driAn  · 技术社区  · 17 年前

    在VisualStudio 2008中,自从我将这种风格添加到应用程序后,设计界面就空了。xaml:

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

    并在顶部添加所需的名称空间 数据: 可解决的

    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    

    运行Silverlight应用程序时,一切正常。但是,设计图面是空的,我在编辑xaml时出现了以下错误:

    属性值无效 数据:DataGridCell for property 目标类型

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

    更新: 当我从应用程序中移动样式时也是如此。xaml到第页。xaml,设计师又开始工作了。。有什么想法吗?

    3 回复  |  直到 17 年前
        1
  •  0
  •   Franci Penov    17 年前

    你试过这个吗?

    <Style x:Key="RightAlignedCell" TargetType="{x:Type data:DataGridCell}">
        <Style.Setters>
            <Setter Property="HorizontalContentAlignment" Value="Right" />
        </Style.Setters>
    </Style>
    
        2
  •  0
  •   driAn    17 年前

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

        3
  •  0
  •   Andrew Veresov    17 年前

    将xmlns声明移动到资源字典。这样地: <ResourceDictionary xmlns:myconverters="clr-namespace:MyCustomConverters;assembly=MyCustomConverters"> ... </ResourceDictionary>

    这里可以找到一个例子:博客。安德鲁·维雷索夫。com/post/Silverlight-20-use-of-the-converters-from-external-assembly-in-appxaml。aspx