GridControl 分组排序

方法一:纯代码

this.list.gridControl.ItemsSource = lsItem;

                this.list.gridControl.GroupBy("GroupTitle");
                this.list.gridControl.Columns["GroupTitle"].SortOrder = ColumnSortOrder.Descending;
                //this.list.gridControl.SortBy(this.list.gridControl.Columns["GroupTitle"], ColumnSortOrder.Descending);

                this.list.gridControl.ExpandAllGroups();

 

方法二:XAML定义,构造函数中绑定

 

 

实时分组(先取消之前的分组)

 private void ListGrouping(string strType)
        {
            if (string.IsNullOrEmpty(strType)) return;

            if (strType == "Room")
            {
                //ColumnView.SortInfo
                this.list.gridControl.SortInfo.Clear();//clear grouping
                this.list.gridControl.GroupBy("RoomName");
                this.list.gridControl.Columns["RoomName"].SortOrder = ColumnSortOrder.Ascending;

                this.list.gridControl.ExpandAllGroups();
 
            }
            else if (strType == "Status")
            {
                this.list.gridControl.SortInfo.Clear();//Clear grouping
                this.list.gridControl.GroupBy("Status");
                this.list.gridControl.Columns["Status"].SortOrder = ColumnSortOrder.Ascending;

                this.list.gridControl.ExpandAllGroups();
            }
 
        }

 

posted @ 2014-01-23 19:34  quietwalk  阅读(1764)  评论(0编辑  收藏  举报