Пример #1
0
        private void Grid_Sorting(object sender, DataGridSortingEventArgs e)
        {
            switch (e.Column.SortDirection)
            {
            case ListSortDirection.Ascending:
            {
                e.Column.SortDirection = ListSortDirection.Descending;
                break;
            }

            case ListSortDirection.Descending:
            {
                e.Column.SortDirection = null;
                break;
            }

            default:
            {
                e.Column.SortDirection = ListSortDirection.Ascending;
                break;
            }
            }

            TreeGridFlatModel GridModel    = (TreeGridFlatModel)DataContext;
            PropertyInfo      SortProperty = typeof(TimingDataViewModel).GetProperty(e.Column.SortMemberPath);

            GridModel.Sort(SortProperty, e.Column.SortDirection);

            e.Handled = true;
        }
        private void SortNodes()
        {
            if (SortingColumn == null)
            {
                SortingColumn = Grid.Columns[2];
            }

            TreeGridFlatModel GridModel    = (TreeGridFlatModel)DataContext;
            PropertyInfo      SortProperty = typeof(TimingDataViewModel).GetProperty(SortingColumn.SortMemberPath);

            GridModel.Sort(SortProperty, SortingColumn.SortDirection);
        }
Пример #3
0
        private void SortModel(DataGrid Grid)
        {
            if (Grid.DataContext == null)
            {
                return;
            }

            // Find the column that has a sorting value set, if any.
            DataGridColumn SortedColumn = Grid.Columns.FirstOrDefault(c => c.SortDirection != null);

            if (SortedColumn == null)
            {
                // No sort applied.
                return;
            }

            TreeGridFlatModel Model        = (TreeGridFlatModel)Grid.DataContext;
            PropertyInfo      SortProperty = typeof(TimingDataViewModel).GetProperty(SortedColumn.SortMemberPath);

            Model.Sort(SortProperty, SortedColumn.SortDirection);
        }
Пример #4
0
 private void UpdateTabVisibility(TreeGridFlatModel TabModel, TabItem Tab, TimingDataGrid Grid)
 {
     Tab.Visibility   = TabModel == null ? Visibility.Collapsed : Visibility.Visible;
     Grid.DataContext = TabModel;
 }