Exemplo n.º 1
0
        public static void UpdateSortColumn(ListView lv, int newColumn, bool useChecked)
        {
            SortTypeListViewItemSorter comp = (SortTypeListViewItemSorter)lv.ListViewItemSorter;

            if (comp != null)
            {
                comp.UseChecked = useChecked;
                if (newColumn != -1)
                {
                    if (comp.SortColumn == newColumn)
                    {
                        if (comp.Descending)
                        {
                            comp.Descending = false;
                        }
                        else
                        {
                            comp.Descending = true;
                        }
                    }
                    else
                    {
                        comp.SortColumn = newColumn;
                        SortType newSort = (SortType)(lv.Columns[newColumn].Tag);
                        comp.SortMethod = newSort;
                    }
                }
                lv.BeginUpdate();
                lv.Sort();
                lv.EndUpdate();
            }
        }
Exemplo n.º 2
0
        public static void UpdateSortSpecific(ListView lv, int newColumn, bool useChecked, SortType newSort, bool descending)
        {
            SortTypeListViewItemSorter comp = (SortTypeListViewItemSorter)lv.ListViewItemSorter;

            if (comp != null)
            {
                comp.UseChecked = useChecked;
                comp.SortColumn = newColumn;
                comp.SortMethod = newSort;
                comp.Descending = descending;
                lv.BeginUpdate();
                lv.Sort();
                lv.EndUpdate();
            }
        }