让我直接看看它。我有一个DataGrid有几个设置列,像这样:WPF DataGrid排序虚拟化属性
<ctrl:DataGridWithFooter
FooterRowsCount="1"
x:Name="MyGrid"
CanUserDeleteRows="False"
CanUserSortColumns="True"
AutoGenerateColumns="False"
ItemsSource="{Binding Path=Model, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding Path=Idle}">
<DataGrid.Columns>
<DataGridTextColumn Header="Level"
Binding="{Binding Path=Name, Mode=OneWay}" />
<!--Snip-->
</ctrl:DataGridWithFooter>
和你所期望的一个模型。在应用程序运行,不过,我在那里我会补充说反映在模型列表中的元素新列的情况,所以我得到这样
<DataGridTextColumn Binding="{Binding Path=Attributes[0]}" />
或类似的东西绑定表达式。显示和自行排序很好,但我遇到了一个问题,我需要强制排队将我的总数降到最低,结果我需要使用一些我在网上找到的代码以使其正常工作(available here, works as advertised) 。然而,我发现他的排序类在这个新的自定义的DataGrid类中崩溃了,我的列表元素绑定。我的问题是,我将如何修改此构造
public PropertyAccessor(Type targetType, string property) {
IsList_ = false;
mTargetType = targetType;
mProperty = property;
PropertyInfo propertyInfo =
targetType.GetProperty(mProperty);
mCanRead = propertyInfo.CanRead;
mCanWrite = propertyInfo.CanWrite;
mPropertyType = propertyInfo.PropertyType;
}
为了得到我需要能够反映出来,排序列表元素的所有信息?
是的,这基本上是我作为解决方法所做的,找到了一个“同步网格”类,它可以让您将两个或更多个网格连接在一起。您的解决方案非常棒,而且它是我以后投入使用的库中的一个组件,但不幸的是,这似乎不适合您。谢谢你的帮助! – HeadBangingSloth 2012-08-13 03:15:37
@HeadBangingSloth您可以将您的解决方案发送到我的博客,我想看看它。甚至在这里。 – Artiom 2012-08-13 06:15:13
对不起,您的网页上无法阅读俄文,但我使用的是[在此](http://thibaud60.blogspot.com.au/2010/02/footer-on-wpf-datagrid-by-use -several.html) – HeadBangingSloth 2012-08-15 04:29:09