예제 #1
0
        protected void AdvancedSortOrderList_InsertCommand(object sender, AjaxControlToolkit.ReorderListCommandEventArgs e)
        {
            DropDownList        ColumnsDropDownList = (DropDownList)e.Item.FindControl("AddSortColumnsList");
            CheckBox            AddColumnToSortDescendingCheckBox = (CheckBox)e.Item.FindControl("AddColumnToSortDescendingCheckBox");
            ColumnSortDirection newDirection  = (AddColumnToSortDescendingCheckBox.Checked) ? ColumnSortDirection.Descending : ColumnSortDirection.Ascending;
            ListViewSortColumn  newSortColumn = new ListViewSortColumn(ColumnsDropDownList.SelectedValue, newDirection);

            listSettings.SortColumns.Add(newSortColumn);

            SaveAdvancedSortChanges();
        }
예제 #2
0
        static void Sort(ListView grid)
        {
            ColumnSortDirection    currentDirection = GetSortDirection(grid);
            SortableGridViewColumn column           = GetCurrentSortColumn(grid);
            ICollectionView        dataView         = CollectionViewSource.GetDefaultView(grid.ItemsSource);

            if (dataView == null)
            {
                return;
            }

            if (column != null && GetSortMode(grid) == ListViewSortMode.Automatic && currentDirection != ColumnSortDirection.None)
            {
                string sortBy = column.SortBy;
                if (sortBy == null)
                {
                    Binding binding = column.DisplayMemberBinding as Binding;
                    if (binding != null && binding.Path != null)
                    {
                        sortBy = binding.Path.Path;
                    }
                }

                dataView.SortDescriptions.Clear();
                if (sortBy != null)
                {
                    ListSortDirection direction;
                    if (currentDirection == ColumnSortDirection.Descending)
                    {
                        direction = ListSortDirection.Descending;
                    }
                    else
                    {
                        direction = ListSortDirection.Ascending;
                    }
                    dataView.SortDescriptions.Add(new SortDescription(sortBy, direction));
                }
            }
            else
            {
                dataView.SortDescriptions.Clear();
            }

            dataView.Refresh();
        }
예제 #3
0
 public static void SetSortDirection(ListView listView, ColumnSortDirection value)
 {
     listView.SetValue(SortDirectionProperty, value);
 }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ListViewSortColumn"/> class.
 /// </summary>
 /// <param name="columnName">Name of the column.</param>
 /// <param name="sortDirection">The sort direction.</param>
 public ListViewSortColumn(string columnName, ColumnSortDirection sortDirection)
 {
     _columnName    = columnName;
     _sortDirection = sortDirection;
 }
 public IndexColumnAnnotation(string columnName, string sort)
 {
     ColumnName    = columnName;
     SortDirection = ColumnSortDirectionParser.Parse(sort);
 }
 public IndexColumnAnnotation(string columnName, ColumnSortDirection sortDirection = ColumnSortDirection.Ascending)
 {
     ColumnName    = columnName;
     SortDirection = sortDirection;
 }
예제 #7
0
        public void Sort(int column, ColumnSortDirection direction)
        {
            ObservableCollection<ValuesContainer> sortedRows;
            if (direction == ColumnSortDirection.Ascending)
            {
                sortedRows = new ObservableCollection<ValuesContainer>(rows.OrderBy(x => x[column]));
            }
            else
            { sortedRows = new ObservableCollection<ValuesContainer>(rows.OrderByDescending(x => x[column])); }

            rows.Clear();
            foreach(var singleRow in sortedRows)
            { rows.Add(singleRow); }
        }
예제 #8
0
		public static void SetSortDirection(ListView listView, ColumnSortDirection value) {
			listView.SetValue(SortDirectionProperty, value);
		}
 /// <summary>
 /// Initializes a new instance of the <see cref="UserTicketListSortColumn"/> class.
 /// </summary>
 /// <param name="columnName">Name of the column to sort.</param>
 /// <param name="sortDirection">The sort direction.</param>
 public UserTicketListSortColumn(string columnName, ColumnSortDirection sortDirection)
 {
     ColumnName    = columnName;
     SortDirection = sortDirection;
 }
예제 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TicketListSortColumn"/> class.
 /// </summary>
 /// <param name="columnName">Name of the column to sort.</param>
 /// <param name="sortDirection">The sort direction.</param>
 public TicketListSortColumn(string columnName, ColumnSortDirection sortDirection)
 {
     ColumnName = columnName;
     SortDirection = sortDirection;
 }
예제 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ListViewSortColumn"/> class.
 /// </summary>
 /// <param name="columnName">Name of the column.</param>
 /// <param name="sortDirection">The sort direction.</param>
 public ListViewSortColumn(string columnName, ColumnSortDirection sortDirection)
 {
     _columnName = columnName;
     _sortDirection = sortDirection;
 }
예제 #12
0
 protected string GetSortItemDirectionImage(ColumnSortDirection direction)
 {
     return(string.Format("~/Controls/Images/{0}.png", (direction == ColumnSortDirection.Ascending) ? "up" : "down"));
 }
 protected string GetSortItemDirectionImage(ColumnSortDirection direction)
 {
     return string.Format("~/Controls/Images/{0}.png", (direction == ColumnSortDirection.Ascending) ? "up" : "down");
 }