コード例 #1
0
ファイル: ColHeaderCell.cs プロジェクト: Daoting/dt
        void ChangedSortState()
        {
            // 允许排序
            if (!_owner.Lv.Cols.AllowSorting || !Col.AllowSorting)
            {
                return;
            }

            ListSortDirection dir  = ListSortDirection.Ascending;
            SortDescription   desc = _owner.Lv.SortDesc;

            if (desc != null && !string.IsNullOrEmpty(desc.ID))
            {
                if (desc.ID.Equals(Col.ID, StringComparison.OrdinalIgnoreCase))
                {
                    if (desc.Direction == ListSortDirection.Ascending)
                    {
                        dir = ListSortDirection.Descending;
                    }
                }
                else
                {
                    ColHeaderCell cell = _owner.GetCellByID(desc.ID);
                    if (cell != null)
                    {
                        cell.ClearValue(SortStateProperty);
                    }
                }
            }
            _owner.Lv.SortDesc = new SortDescription(Col.ID, dir);
            SortState          = (dir == ListSortDirection.Ascending) ? "\uE017" : "\uE018";
        }