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(); }
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(); }
public static void SetSortDirection(ListView listView, ColumnSortDirection value) { listView.SetValue(SortDirectionProperty, value); }
/// <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; }
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); } }
/// <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; }
/// <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; }
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"); }