コード例 #1
0
ファイル: MainControl.cs プロジェクト: tyanque/XrmToolBox
        private void ListViewColumnClick(object sender, ColumnClickEventArgs e)
        {
            var lv = (ListView)sender;

            lv.Sorting = lv.Sorting == SortOrder.Ascending ? SortOrder.Descending : SortOrder.Ascending;

            lv.ListViewItemSorter = new ListViewItemComparer(e.Column, lv.Sorting);

            var configuration = sortingConfigurations.FirstOrDefault(sc => sc.List == lv);

            if (configuration == null)
            {
                configuration = new SortingConfiguration
                {
                    ColumnIndex = e.Column,
                    List        = lv,
                    Order       = lv.Sorting
                };

                sortingConfigurations.Add(configuration);
            }
            else
            {
                configuration.ColumnIndex = e.Column;
                configuration.Order       = lv.Sorting;
            }
        }
コード例 #2
0
ファイル: MainControl.cs プロジェクト: Quodnon/XrmToolBox
        private void ListViewColumnClick(object sender, ColumnClickEventArgs e)
        {
            var lv = (ListView) sender;

            lv.Sorting = lv.Sorting == SortOrder.Ascending ? SortOrder.Descending : SortOrder.Ascending;

            lv.ListViewItemSorter = new ListViewItemComparer(e.Column, lv.Sorting);

            var configuration = sortingConfigurations.FirstOrDefault(sc => sc.List == lv);
            if (configuration == null)
            {
                configuration = new SortingConfiguration
                {
                    ColumnIndex = e.Column,
                    List = lv,
                    Order = lv.Sorting
                };

                sortingConfigurations.Add(configuration);
            }
            else
            {
                configuration.ColumnIndex = e.Column;
                configuration.Order = lv.Sorting;
            }
        }