示例#1
0
        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
        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;
            }
        }