Пример #1
0
 void ShowColumnChooser()
 {
     if (viewModel.ShowColumnChooser && viewModel.UseDefaultColumnChooser)
     {
         chooserWindow.Visibility = System.Windows.Visibility.Visible;
     }
     else
     {
         if (!viewModel.ShowColumnChooser)
         {
             return;
         }
         var visibleColumns = this.AssociatedObject.dataGrid.Columns;
         ObservableCollection <ColumnChooserItems> totalColumns = GetColumnsDetails(visibleColumns);
         CustomColumnChooserViewModel chooserViewModel          = new CustomColumnChooserViewModel(totalColumns);
         CustomColumnChooser          ColumnChooserView         = new CustomColumnChooser(chooserViewModel);
         ColumnChooserView.Owner  = Application.Current.MainWindow;
         chooserWindow.Visibility = System.Windows.Visibility.Collapsed;
         if ((bool)ColumnChooserView.ShowDialog())
         {
             ClickOKButton(chooserViewModel.ColumnCollection, this.AssociatedObject.dataGrid);
         }
         viewModel.ShowColumnChooser = false;
     }
 }
Пример #2
0
        void ShowColumnChooser()
        {
            var columns = this.AssociatedObject.dataGrid.Columns;
            ObservableCollection <ColumnChooserItems> hiddenColumns;
            ObservableCollection <ColumnChooserItems> visibleColumns;

            GetColumnsDetails(columns, out hiddenColumns, out visibleColumns);
            CustomColumnChooserViewModel chooserViewModel  = new CustomColumnChooserViewModel(hiddenColumns, visibleColumns);
            CustomColumnChooser          ColumnChooserView = new CustomColumnChooser();

            ColumnChooserView.DataContext = chooserViewModel;
            ColumnChooserView.Owner       = Application.Current.MainWindow;
            if ((bool)ColumnChooserView.ShowDialog())
            {
                ClickOKButton(chooserViewModel.HiddenColumnCollection, chooserViewModel.VisibleColumnCollection, this.AssociatedObject.dataGrid);
            }
        }