silverlight 3 datagrid x:名称问题

时间:2009-07-23 08:47:32

标签: silverlight silverlight-3.0 datagrid

我最近将SL2解决方案提升到了SL3。我有一个只包含数据网格的UserControl:

<UserControl x:Class="Case.CaseDataGrid_View"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data">


    <data:DataGrid Language="en-GB"
                   AutoGenerateColumns="True"
                   RowHeight="20"
                   ItemsSource="{Binding Cases}"
                   SelectedItem="{Binding SelectedCase, Mode=TwoWay}">

    </data:DataGrid>

</UserControl>

这是从父页面引用的:

<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"                       
             mc:Ignorable="d"
             x:Class="eg.WorkManager.UI.Module.CaseEnquiry.CaseEnquiry"
             d:DesignWidth="888"
             d:DesignHeight="480"
             xmlns:case="clr-namespace:Case;assembly=UserControls">

    <ContentControl x:Name="SecurityContext"
                    HorizontalContentAlignment="Stretch"
                    VerticalContentAlignment="Stretch">
        <Grid x:Name="LayoutRoot">
            <case:CaseDataGrid_View Grid.Row="0" 
                                    MinHeight="200" 
                                    Margin="8,8,0,8" 
                                    HorizontalAlignment="Left" 
                                    VerticalAlignment="Top" 
                                    Height="Auto" 
                                    Cases="{Binding Cases}" 
                                    SelectedCase="{Binding SelectedCase, Mode=TwoWay}" 
                                    CustomGridFields="{Binding CustomDataGridFields}"  />

</Grid>
    </ContentControl>
</UserControl>

当我将x:Name属性添加到我的基本UserControl时,User控件引用上的所有属性都会开始抛出错误:

<data:DataGrid x:Name="AnythingItSeems" 
Language="en-GB"
                       AutoGenerateColumns="True"
                       RowHeight="20"
                       ItemsSource="{Binding Cases}"
                       SelectedItem="{Binding SelectedCase, Mode=TwoWay}">

        </data:DataGrid>

错误首先报告为未知属性Grid.Row ,指向页面中的XAML:

<case:CaseDataGrid_View Grid.Row="0" 

当我删除 Grid.Row 属性时,下一次抛出类似的错误。

这是数据网格的已知问题/错误吗?如果没有,任何想法导致了什么?

谢谢, 标记

1 个答案:

答案 0 :(得分:0)

我的SL3 updgrade似乎没有正确更新我的SL程序集引用(我在源代码中保留SL程序集的副本,因此不使用C:\作为默认值的开发人员仍然可以打开项目并编译)