private void OnAddRemovedColumn(object sender, RoutedEventArgs e)
 {
     if (_removedColumn != null)
     {
         DataGrid.Columns.Add(_removedColumn);
         _removedColumn = null;
     }
 }
 private void OnRemoveFirstColumn(object sender, RoutedEventArgs e)
 {
     if (DataGrid.Columns.Count > 0)
     {
         _removedColumn = DataGrid.Columns.First();
         DataGrid.Columns.Remove(_removedColumn);
     }
 }
Exemple #3
0
        /// <summary>Selects a column for ordering. </summary>
        /// <param name="column">The column. </param>
        /// <param name="ascending">The value indicating whether to sort the column ascending; otherwise descending. </param>
        /// <returns>Returns true if column could be changed. </returns>
        public bool SelectColumn(DataGridColumnBase column, bool ascending)
        {
            if (column.CanSort)
            {
                var oldColumn = SelectedColumn;
                if (oldColumn != null)
                {
                    oldColumn.IsSelected = false;
                }

                SelectedColumn             = column;
                SelectedColumn.IsSelected  = true;
                SelectedColumn.IsAscending = ascending;

                UpdateItemsOrder();
                return(true);
            }
            return(false);
        }
Exemple #4
0
 /// <summary>Selects a column for ordering.
 /// If the column is not selected the the default ordering is used (IsAscendingDefault property).
 /// If the column is already selected then the ordering direction will be inverted. </summary>
 /// <param name="column">The column. </param>
 /// <returns>Returns true if column could be changed. </returns>
 public bool SelectColumn(DataGridColumnBase column)
 {
     return(SelectColumn(column, column == SelectedColumn ? !column.IsAscending : column.IsAscendingDefault));
 }
 internal DataGridOrderChangedEventArgs(DataGridColumnBase column)
 {
     Column = column;
 }
Exemple #6
0
 internal DataGridOrderChangedEventArgs(DataGridColumnBase column)
 {
     Column = column;
 }