C1 DataGrid不显示绑定数据

时间:2013-11-05 21:10:05

标签: c# wpf datagrid

我正在寻找可能发生的事情的基本想法。我已将数据绑定到DataGrid,在我的本地工作正常。有时候,在开发测试服务器上,数据不会显示在我制作的网格中。其他人工作正常。在某些机器上,这些网格工作正常。存在属于所有行的数据,下面有数据用于所有内容,但它只是不可见。在绑定到20个对象的网格中,将有20个完全空白的行,我可以单击它们并使用SelectedItem属性从中获取值。

我已经多次尝试清除缓存了。将ItemsSource属性重置为null然后重置基础数据,并在网格上调用Refresh()。因此,关于绑定数据的原因可能会创建一行但没有任何可见的任何想法。

以下是其中一个网格的示例。此网格在构造函数中设置了第一列,但未绑定。顶部位于服务器上,底部位于我的本地主机上。

Sever based and local version of the same grid

下面是图片中网格的XAML代码。绑定的对象是名为AccountTypeGridClass的类的列表。所有属性都是公共字符串,实现了gets和sets,以及抛出的属性更改事件。虽然没有使用。

<af:GroupHeader x:Name="AccountTypeHeader" Header="Account Type" Grid.Row="0" Margin="5" >
        <dataGrid:DataGridBase HorizontalAlignment="Left" x:Name="AccountTypeGrid" GridLinesVisibility="None"
                               RowBackground="White" 
                               HorizontalScrollBarVisibility="Hidden" HeadersVisibility="Column"
                               CanUserAddRows="False" CanUserResizeRows="False"
                               SelectionMode="SingleRow" >

            <c1:C1DataGrid.Columns>

                <c1:DataGridTemplateColumn Header="Type" Name="TypeColumn" Width="100">
                    <c1:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock VerticalAlignment="Center" Margin="3, 0, 0, 0" Text="Account Type" af:AutoToolTip.Active="True"  />
                        </DataTemplate>
                    </c1:DataGridTemplateColumn.CellTemplate>
                </c1:DataGridTemplateColumn>

                <c1:DataGridTemplateColumn Header="Code" Name="AccountTypeCodeColumn" Width="100">
                    <c1:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock VerticalAlignment="Center" Margin="3, 0, 0, 0" Text="{Binding AccountTypeCode}" af:AutoToolTip.Active="True" />
                        </DataTemplate>
                    </c1:DataGridTemplateColumn.CellTemplate>
                </c1:DataGridTemplateColumn>

                <c1:DataGridTemplateColumn Header="Code Description" Name="AccountTypeCodeDescriptionColumn" Width="200">
                    <c1:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock VerticalAlignment="Center" Margin="3, 0, 0, 0" Text="{Binding AccountTypeCodeDescription}" af:AutoToolTip.Active="True" />
                        </DataTemplate>
                    </c1:DataGridTemplateColumn.CellTemplate>
                </c1:DataGridTemplateColumn>

            </c1:C1DataGrid.Columns>

        </dataGrid:DataGridBase>
    </af:GroupHeader>

编辑:一旦我弄明白,我会更新答案但是curiousBoy的评论让我走上正轨。它似乎是网格绑定的对象。描述原始问题的另一种方法是,它就像网格中的列绑定到某些机器上的错误列名。我找到了一种非常相似的方式,所以我试图找出造成这个问题的实际差异。

0 个答案:

没有答案
相关问题