示例#1
0
        static void OnSortDirectionChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            ListView grid = sender as ListView;

            if (grid != null)
            {
                SortableGridViewColumn col = GetCurrentSortColumn(grid);
                if (col != null)
                {
                    col.SortDirection = (ColumnSortDirection)args.NewValue;
                }
                Sort(grid);
            }
        }
示例#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
        static void OnCurrentSortColumnChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            ListView grid = sender as ListView;

            if (grid != null)
            {
                SortableGridViewColumn oldColumn = (SortableGridViewColumn)args.OldValue;
                if (oldColumn != null)
                {
                    oldColumn.SortDirection = ColumnSortDirection.None;
                }
                SortableGridViewColumn newColumn = (SortableGridViewColumn)args.NewValue;
                if (newColumn != null)
                {
                    newColumn.SortDirection = GetSortDirection(grid);
                }
                Sort(grid);
            }
        }
示例#4
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.listView = ((System.Windows.Controls.ListView)(target));
     
     #line 21 "..\..\..\OpenListDialog.xaml"
     this.listView.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ListView_SelectionChanged);
     
     #line default
     #line hidden
     
     #line 22 "..\..\..\OpenListDialog.xaml"
     this.listView.Loaded += new System.Windows.RoutedEventHandler(this.listView_Loaded);
     
     #line default
     #line hidden
     
     #line 22 "..\..\..\OpenListDialog.xaml"
     this.listView.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.listView_MouseDoubleClick);
     
     #line default
     #line hidden
     return;
     case 2:
     this.nameColumn = ((ICSharpCode.ILSpy.Controls.SortableGridViewColumn)(target));
     return;
     case 3:
     this.okButton = ((System.Windows.Controls.Button)(target));
     
     #line 31 "..\..\..\OpenListDialog.xaml"
     this.okButton.Click += new System.Windows.RoutedEventHandler(this.OKButton_Click);
     
     #line default
     #line hidden
     return;
     case 4:
     
     #line 36 "..\..\..\OpenListDialog.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.CreateButton_Click);
     
     #line default
     #line hidden
     return;
     case 5:
     this.removeButton = ((System.Windows.Controls.Button)(target));
     
     #line 37 "..\..\..\OpenListDialog.xaml"
     this.removeButton.Click += new System.Windows.RoutedEventHandler(this.RemoveButton_Click);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }
示例#5
0
 public static void SetCurrentSortColumn(ListView listView, SortableGridViewColumn value)
 {
     listView.SetValue(CurrentSortColumnProperty, value);
 }
示例#6
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.filterTextBox = ((System.Windows.Controls.TextBox)(target));
     
     #line 25 "..\..\OpenFromGacDialog.xaml"
     this.filterTextBox.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.FilterTextBox_TextChanged);
     
     #line default
     #line hidden
     return;
     case 2:
     this.listView = ((System.Windows.Controls.ListView)(target));
     
     #line 27 "..\..\OpenFromGacDialog.xaml"
     this.listView.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ListView_SelectionChanged);
     
     #line default
     #line hidden
     return;
     case 3:
     this.nameColumn = ((ICSharpCode.ILSpy.Controls.SortableGridViewColumn)(target));
     return;
     case 4:
     this.okButton = ((System.Windows.Controls.Button)(target));
     
     #line 39 "..\..\OpenFromGacDialog.xaml"
     this.okButton.Click += new System.Windows.RoutedEventHandler(this.OKButton_Click);
     
     #line default
     #line hidden
     return;
     case 5:
     this.gacReadingProgressBar = ((System.Windows.Controls.ProgressBar)(target));
     return;
     }
     this._contentLoaded = true;
 }
示例#7
0
		public static void SetCurrentSortColumn(ListView listView, SortableGridViewColumn value) {
			listView.SetValue(CurrentSortColumnProperty, value);
		}