DataGrid排序不起作用 [英] DataGrid Sorting not working

查看:102
本文介绍了DataGrid排序不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在设计时在e dataGrid上创建并在运行时以
创建其列

hi i have created on e dataGrid at design time and create its column at runtime as

<sdk:datagrid canusersortcolumns="True" autogeneratecolumns="False" grid.row="2" horizontalalignment="Left" margin="18,0,0,0" name="grd_Enterprise_summary" verticalalignment="Top" xmlns:sdk="#unknown">

           </sdk:datagrid>


private DataGridColumn CreateColumn(string property)
        {
            return new DataGridTextColumn()
            {
                CanUserSort = true,
                Header = property,
                SortMemberPath = property,
                IsReadOnly = true,
                Binding = new Binding()
                {
                    Converter = _rowIndexConverter,
                    ConverterParameter = property
                }
            };
        }


数据网格绑定的完成方式为


Datagrid binding is done as

Dictionary<string,> firstRow1 = new Dictionary<string,>();

               this.AddColumnToGrid(grd_Enterprise_summary, (IEnumerable<dictionary><string,>>)record1);
               grd_Enterprise_summary.ItemsSource = record1;</dictionary>


当我单击标题时不执行排序.

我该怎么办?

在此先感谢


when i click on header sorting is not performed .

What should i do for this ?

thanks in advance

推荐答案

我可以看到缺少datagrid的ItemsSource.
定义itemsource,然后重试.
I can see the ItemsSource for the datagrid is missing.
Define the itemsource and they try again.


这篇关于DataGrid排序不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆