public ResetTo ( |
||
v | ||
Résultat | void |
protected override void OnPreviewMouseDown(MouseButtonEventArgs e) { if (Header) { var pt = e.GetPosition(this); foreach (var viz in _visualChildren) { var v = viz as HeaderTextVisual; if (v != null) { Rect rc = new Rect(v.X, v.Y, v.Size.Width, v.Size.Height); if (rc.Contains(pt)) { // Order: None -> Ascending -> Descending -> Ascending -> Descending -> ... v.ToggleSortOrder(); if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)) { // Shift+Click adds column to the sorting set. _sortOrder.Add(v); } else { // Clear all column sorts except the one that was clicked on. ResetSortToPrimary(v); _sortOrder.ResetTo(v); } SortOrderChanged?.Invoke(this, EventArgs.Empty); break; } } } } // Find out which visual is it base.OnPreviewMouseDown(e); }
public void ToggleSort(HeaderTextVisual v, bool add) { // Order: None -> Ascending -> Descending -> Ascending -> Descending -> ... v.ToggleSortOrder(); if (add) { // Shift+Click adds column to the sorting set. _sortOrder.Add(v); } else { // Clear all column sorts except the one that was clicked on. ResetSortToPrimary(v); _sortOrder.ResetTo(v); } SortOrderChanged?.Invoke(this, EventArgs.Empty); }