-
-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathTableViewColumnHeader.cs
More file actions
645 lines (564 loc) · 22.3 KB
/
TableViewColumnHeader.cs
File metadata and controls
645 lines (564 loc) · 22.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
using Microsoft.UI;
using Microsoft.UI.Input;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Media.Imaging;
using Microsoft.UI.Xaml.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Windows.System;
using Windows.UI.Core;
using WinUI.TableView.Collections;
using WinUI.TableView.Extensions;
using SD = WinUI.TableView.SortDirection;
namespace WinUI.TableView;
/// <summary>
/// Represents the header of a column in a TableView.
/// </summary>
[TemplateVisualState(Name = VisualStates.StateNormal, GroupName = VisualStates.GroupCommon)]
[TemplateVisualState(Name = VisualStates.StatePointerOver, GroupName = VisualStates.GroupCommon)]
[TemplateVisualState(Name = VisualStates.StatePressed, GroupName = VisualStates.GroupCommon)]
[TemplateVisualState(Name = VisualStates.StateFocused, GroupName = VisualStates.GroupFocus)]
[TemplateVisualState(Name = VisualStates.StateUnfocused, GroupName = VisualStates.GroupFocus)]
[TemplateVisualState(Name = VisualStates.StateUnsorted, GroupName = VisualStates.GroupSort)]
[TemplateVisualState(Name = VisualStates.StateSortAscending, GroupName = VisualStates.GroupSort)]
[TemplateVisualState(Name = VisualStates.StateSortDescending, GroupName = VisualStates.GroupSort)]
[TemplateVisualState(Name = VisualStates.StateFiltered, GroupName = VisualStates.GroupFilter)]
[TemplateVisualState(Name = VisualStates.StateUnfiltered, GroupName = VisualStates.GroupFilter)]
public partial class TableViewColumnHeader : ContentControl
{
private TableView? _tableView;
private TableViewHeaderRow? _headerRow;
private Button? _optionsButton;
private MenuFlyout? _optionsFlyout;
private ContentPresenter? _contentPresenter;
private Rectangle? _v_gridLine;
private CheckBox? _selectAllCheckBox;
private OptionsFlyoutViewModel _optionsFlyoutViewModel = default!;
private bool _resizeStarted;
private double _resizeStartingWidth;
private bool _resizePreviousStarted;
private TextBox? _searchBox;
private double _reorderStartingPosition;
private bool _reorderStarted;
private RenderTargetBitmap? _dragVisuals;
private ListView? _filterItemsList;
/// <summary>
/// Initializes a new instance of the TableViewColumnHeader class.
/// </summary>
public TableViewColumnHeader()
{
DefaultStyleKey = typeof(TableViewColumnHeader);
ManipulationMode = ManipulationModes.TranslateX;
RegisterPropertyChangedCallback(WidthProperty, OnWidthChanged);
RightTapped += OnRightTapped;
}
/// <summary>
/// Handles changes to the Width property.
/// </summary>
private void OnWidthChanged(DependencyObject sender, DependencyProperty dp)
{
if (Column is not null)
{
Column.ActualWidth = Width;
}
}
/// <summary>
/// Handles the RightTapped event.
/// </summary>
private void OnRightTapped(object sender, RightTappedRoutedEventArgs e)
{
// Check if right-click is enabled via TableView or column is currently resizing
if (_tableView?.UseRightClickForColumnFilter != true || IsSizingCursor)
{
return;
}
// Shows the button's flyout if options button is available and filtering is enabled
if (_optionsButton is not null && CanFilter)
{
_optionsButton.Flyout?.ShowAt(_optionsButton);
e.Handled = true;
}
}
/// <summary>
/// Sorts the column in the specified direction.
/// </summary>
private void DoSort(SD? direction, bool singleSorting = true)
{
if (CanSort && Column is not null && _tableView is { CollectionView: CollectionView { } collectionView })
{
var eventArgs = new TableViewSortingEventArgs(Column);
_tableView.OnSorting(eventArgs);
if (eventArgs.Handled) return;
using var defer = collectionView.DeferRefresh();
if (singleSorting)
{
_tableView.ClearAllSortingWithEvent();
}
else
{
ClearSortingWithEvent();
}
if (direction is not null)
{
var boundColumn = Column as TableViewBoundColumn;
Column.SortDirection = direction;
// Prefer explicit SortMemberPath if provided, otherwise use bound column's property path
var sortPath = Column.SortMemberPath ?? boundColumn?.PropertyPath;
_tableView.SortDescriptions.Add(
new ColumnSortDescription(Column!, sortPath, direction.Value));
}
}
}
/// <summary>
/// Clears the sorting for the column.
/// </summary>
private void ClearSortingWithEvent()
{
var eventArgs = new TableViewClearSortingEventArgs();
_tableView?.OnClearSorting(eventArgs);
if (eventArgs.Handled)
{
return;
}
if (CanSort && _tableView?.CollectionView is CollectionView { } collectionView && Column is not null)
{
using var defer = collectionView.DeferRefresh();
_tableView.DeselectAll();
Column.SortDirection = null;
collectionView.SortDescriptions.RemoveWhere(x => x is ColumnSortDescription columnSort && columnSort.Column == Column);
}
}
/// <summary>
/// Clears the filter for the column.
/// </summary>
private void ClearFilter()
{
_tableView?.FilterHandler?.ClearFilter(Column!);
}
/// <summary>
/// Applies the filter for the column.
/// </summary>
private void ApplyFilter()
{
if (_selectAllCheckBox?.IsChecked is true && string.IsNullOrEmpty(_searchBox?.Text))
{
ClearFilter();
}
else if (_tableView is not null)
{
_optionsFlyoutViewModel.SelectedValues = GetSelectedValues();
_tableView.FilterHandler.SelectedValues[Column!] = _optionsFlyoutViewModel.SelectedValues;
_tableView.FilterHandler?.ApplyFilter(Column!);
}
}
private ICollection<object?> GetSelectedValues()
{
var selectedValues = _optionsFlyoutViewModel.FilterItems.Where(x => x.IsSelected).Select(x => x.Value);
var firstItem = selectedValues.FirstOrDefault(x => x is not null);
var firstItemType = firstItem?.GetType();
return firstItemType switch
{
Type t when t == typeof(int) => new ObjectBackedTypedSet<int?>(selectedValues),
Type t when t == typeof(DateTime) => new ObjectBackedTypedSet<DateTime?>(selectedValues),
Type t when t == typeof(bool) => new ObjectBackedTypedSet<bool?>(selectedValues),
Type t when t == typeof(long) => new ObjectBackedTypedSet<long?>(selectedValues),
Type t when t == typeof(double) => new ObjectBackedTypedSet<double?>(selectedValues),
_ => [.. selectedValues],
};
}
/// <summary>
/// Hides the options flyout.
/// </summary>
private void HideFlyout()
{
_optionsFlyout?.Hide();
}
/// <inheritdoc/>
protected override void OnTapped(TappedRoutedEventArgs e)
{
if (CanSort && Column is not null && _tableView is not null && !IsSizingCursor && !_reorderStarted)
{
var isCtrlButtonDown = InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Control) is
CoreVirtualKeyStates.Down or (CoreVirtualKeyStates.Down | CoreVirtualKeyStates.Locked);
DoSort(GetNextSortDirection(), !isCtrlButtonDown);
}
base.OnTapped(e);
}
private SD? GetNextSortDirection()
{
return Column?.SortDirection switch
{
SD.Ascending => SD.Descending,
SD.Descending => null,
_ => SD.Ascending,
};
}
/// <inheritdoc/>
protected override void OnApplyTemplate()
{
base.OnApplyTemplate();
_tableView = this.FindAscendant<TableView>();
_headerRow = this.FindAscendant<TableViewHeaderRow>();
_optionsButton = GetTemplateChild("OptionsButton") as Button;
_optionsFlyout = GetTemplateChild("OptionsFlyout") as MenuFlyout;
_contentPresenter = GetTemplateChild("ContentPresenter") as ContentPresenter;
_v_gridLine = GetTemplateChild("VerticalGridLine") as Rectangle;
if (_tableView is null || _optionsButton is null || _optionsFlyout is null)
{
return;
}
_optionsFlyout.Opening += OnOptionsFlyoutOpening;
_optionsFlyout.Closed += OnOptionsFlyoutClosed;
_optionsButton.Tapped += OnOptionsButtonTaped;
_optionsButton.DataContext = _optionsFlyoutViewModel = new OptionsFlyoutViewModel(_tableView, this);
if (_optionsFlyout.Items.FirstOrDefault(x => x.Name == "ItemsCheckFlyoutItem") is { } menuItem)
{
menuItem.Loaded += OnItemsCheckFlyoutItemLoaded;
}
SetFilterButtonVisibility();
EnsureGridLines();
}
/// <summary>
/// Handles the Loaded event for the items check flyout item.
/// </summary>
private void OnItemsCheckFlyoutItemLoaded(object sender, RoutedEventArgs e)
{
if (sender is not MenuFlyoutItem menuItem) return;
menuItem.Loaded -= OnItemsCheckFlyoutItemLoaded;
if (menuItem?.FindDescendant<CheckBox>(x => x.Name == "SelectAllCheckBox") is { } checkBox)
{
_selectAllCheckBox = checkBox;
_selectAllCheckBox.Content = TableViewLocalizedStrings.SelectAllParenthesized;
_selectAllCheckBox.Checked += OnSelectAllCheckBoxChecked;
_selectAllCheckBox.Unchecked += OnSelectAllCheckBoxUnchecked;
_optionsFlyoutViewModel.SetSelectAllCheckBoxState();
}
if (menuItem?.FindDescendant<TextBox>(x => x.Name == "SearchBox") is { } searchBox)
{
_searchBox = searchBox;
_searchBox.PlaceholderText = TableViewLocalizedStrings.SearchBoxPlaceholder;
_searchBox.TextChanged += OnSearchBoxTextChanged;
#if WINDOWS
_searchBox.PreviewKeyDown += OnSearchBoxKeyDown;
#else
_searchBox.KeyDown += OnSearchBoxKeyDown;
#endif
// Handle Space key to prevent MenuFlyoutItem performing click action.
menuItem.PreviewKeyUp += static (_, e) => e.Handled = e.Key is VirtualKey.Space;
}
_filterItemsList = menuItem?.FindDescendant<ListView>(x => x.Name is "FilterItemsList");
}
/// <summary>
/// Handles the TextChanged event for the search box.
/// </summary>
private void OnSearchBoxTextChanged(object sender, TextChangedEventArgs e)
{
if (_tableView?.FilterHandler is not null)
{
_optionsFlyoutViewModel.FilterItems = _tableView.FilterHandler.GetFilterItems(Column!, _searchBox!.Text);
}
}
/// <summary>
/// Handles the KeyDown event for the search box.
/// </summary>
private void OnSearchBoxKeyDown(object sender, KeyRoutedEventArgs e)
{
if (e.Key == VirtualKey.Enter && _searchBox?.Text.Length > 0)
{
_optionsFlyoutViewModel.OkCommand.Execute(null);
e.Handled = true;
}
}
/// <summary>
/// Handles the Checked event for the select all checkbox.
/// </summary>
private void OnSelectAllCheckBoxChecked(object sender, RoutedEventArgs e)
{
var checkBox = (CheckBox)sender;
_optionsFlyoutViewModel.SetFilterItemsState(checkBox.IsChecked == true);
}
/// <summary>
/// Handles the Unchecked event for the select all checkbox.
/// </summary>
private void OnSelectAllCheckBoxUnchecked(object sender, RoutedEventArgs e)
{
var checkBox = (CheckBox)sender;
_optionsFlyoutViewModel.SetFilterItemsState(checkBox.IsChecked == true);
}
/// <summary>
/// Handles the Opening event for the options flyout.
/// </summary>
private async void OnOptionsFlyoutOpening(object? sender, object e)
{
if (_tableView?.FilterHandler is not null)
{
_optionsFlyoutViewModel.FilterItems = _tableView.FilterHandler.GetFilterItems(Column!, null);
}
if (_searchBox is not null)
{
await Task.Delay(100);
await FocusManager.TryFocusAsync(_searchBox, FocusState.Programmatic);
}
if (_filterItemsList is not null && _optionsFlyoutViewModel.FilterItems.Count > 0)
{
_filterItemsList.ScrollIntoView(_optionsFlyoutViewModel.FilterItems[0]);
}
}
/// <summary>
/// Handles the Closed event for the options flyout.
/// </summary>
private void OnOptionsFlyoutClosed(object? sender, object e)
{
if (_searchBox is not null)
{
_searchBox.Text = string.Empty;
}
}
/// <summary>
/// Handles the Tapped event for the options button.
/// </summary>
private void OnOptionsButtonTaped(object sender, TappedRoutedEventArgs e)
{
e.Handled = true;
}
/// <summary>
/// Handles changes to the SortDirection property.
/// </summary>
internal void OnSortDirectionChanged()
{
if (Column?.SortDirection == SD.Ascending)
{
VisualStates.GoToState(this, false, VisualStates.StateSortAscending);
}
else if (Column?.SortDirection == SD.Descending)
{
VisualStates.GoToState(this, false, VisualStates.StateSortDescending);
}
else
{
VisualStates.GoToState(this, false, VisualStates.StateUnsorted);
}
}
/// <summary>
/// Handles changes to the IsFiltered property.
/// </summary>
internal void OnIsFilteredChanged()
{
if (Column?.IsFiltered is true)
{
VisualStates.GoToState(this, false, VisualStates.StateFiltered);
}
else
{
VisualStates.GoToState(this, false, VisualStates.StateUnfiltered);
}
}
/// <summary>
/// Sets the visibility of the filter button.
/// </summary>
internal void SetFilterButtonVisibility()
{
if (_optionsButton is not null)
{
_optionsButton.Visibility = CanFilter ? Visibility.Visible : Visibility.Collapsed;
}
if (_contentPresenter is not null)
{
_contentPresenter.Margin = CanFilter ? new Thickness(
Padding.Left,
Padding.Top,
Padding.Right + 8,
0) : Padding;
}
}
/// <summary>
/// Determines whether the cursor is in the right resize area.
/// </summary>
private bool IsCursorInRightResizeArea(PointerRoutedEventArgs args)
{
var resizeWidth = args.Pointer.PointerDeviceType == PointerDeviceType.Touch ? 8 : 4;
var point = args.GetCurrentPoint(this);
var resizeHeight = ActualHeight - (CanFilter ? _optionsButton?.ActualHeight ?? 0 : 0);
return ActualWidth - point.Position.X <= resizeWidth && point.Position.Y < resizeHeight;
}
/// <summary>
/// Determines whether the cursor is in the left resize area.
/// </summary>
private bool IsCursorInLeftResizeArea(PointerRoutedEventArgs args)
{
var resizeArea = args.Pointer.PointerDeviceType == PointerDeviceType.Touch ? 8 : 4;
var point = args.GetCurrentPoint(this);
return point.Position.X <= resizeArea && point.Position.Y < ActualHeight;
}
/// <inheritdoc/>
protected override void OnDoubleTapped(DoubleTappedRoutedEventArgs e)
{
base.OnDoubleTapped(e);
if (!IsSizingCursor || _tableView is null)
{
return;
}
var position = e.GetPosition(this);
if (position.X <= 8 && _headerRow?.GetPreviousHeader(this) is { Column: { } } header)
{
var width = Math.Clamp(
header.Column.DesiredWidth,
header.Column.MinWidth ?? _tableView.MinColumnWidth,
header.Column.MaxWidth ?? _tableView.MaxColumnWidth);
header.Column.Width = new GridLength(width, GridUnitType.Pixel);
}
else if (Column is not null)
{
var width = Math.Clamp(
Column.DesiredWidth,
Column.MinWidth ?? _tableView.MinColumnWidth,
Column.MaxWidth ?? _tableView.MaxColumnWidth);
Column.Width = new GridLength(width, GridUnitType.Pixel);
}
}
/// <inheritdoc/>
protected override void OnPointerMoved(PointerRoutedEventArgs e)
{
base.OnPointerMoved(e);
if (CanResize && IsCursorInRightResizeArea(e) && !_reorderStarted)
{
ProtectedCursor = InputSystemCursor.Create(InputSystemCursorShape.SizeWestEast);
}
else if (CanResizePrevious && IsCursorInLeftResizeArea(e) && !_reorderStarted)
{
ProtectedCursor = InputSystemCursor.Create(InputSystemCursorShape.SizeWestEast);
}
else if (!_resizeStarted && !_resizePreviousStarted)
{
ProtectedCursor = null;
}
}
/// <inheritdoc/>
protected override async void OnPointerPressed(PointerRoutedEventArgs e)
{
base.OnPointerPressed(e);
if (IsSizingCursor && CanResize && IsCursorInRightResizeArea(e))
{
_resizeStarted = true;
_resizeStartingWidth = ActualWidth;
CapturePointer(e.Pointer);
}
else if (IsSizingCursor && IsCursorInLeftResizeArea(e) && _headerRow?.GetPreviousHeader(this) is { Column: { } } header)
{
_resizePreviousStarted = true;
_resizeStartingWidth = header.ActualWidth;
CapturePointer(e.Pointer);
}
else if (_tableView?.CanReorderColumns is true && Column?.CanReorder is true)
{
var position = e.GetCurrentPoint(_headerRow).Position;
_reorderStartingPosition = position.X;
_reorderStarted = true;
_dragVisuals = await CreateDragVisualsAsync();
CapturePointer(e.Pointer);
}
}
/// <inheritdoc/>
protected override void OnManipulationDelta(ManipulationDeltaRoutedEventArgs e)
{
base.OnManipulationDelta(e);
if (Column is null || _tableView is null)
{
return;
}
if (_resizeStarted)
{
var width = _resizeStartingWidth + e.Cumulative.Translation.X;
var minWidth = Column.MinWidth ?? _tableView.MinColumnWidth;
var maxWidth = Column.MaxWidth ?? _tableView.MaxColumnWidth;
width = width < minWidth ? minWidth : width;
width = width > maxWidth ? maxWidth : width;
Column.Width = new GridLength(width, GridUnitType.Pixel);
}
else if (_resizePreviousStarted && _headerRow?.GetPreviousHeader(this) is { Column: { } } header)
{
var minWidth = header.Column.MinWidth ?? _tableView.MinColumnWidth;
var maxWidth = header.Column.MaxWidth ?? _tableView.MaxColumnWidth;
var width = _resizeStartingWidth + e.Cumulative.Translation.X;
width = width < minWidth ? minWidth : width;
width = width > maxWidth ? maxWidth : width;
header.Column.Width = new GridLength(width, GridUnitType.Pixel);
}
else if (_reorderStarted && _dragVisuals is not null)
{
var position = _reorderStartingPosition + e.Cumulative.Translation.X;
_headerRow?.ShowColumnDropIndicator(position, _dragVisuals);
}
}
private async Task<RenderTargetBitmap> CreateDragVisualsAsync()
{
var rtb = new RenderTargetBitmap();
await rtb.RenderAsync(this);
return rtb;
}
/// <inheritdoc/>
protected override void OnManipulationCompleted(ManipulationCompletedRoutedEventArgs e)
{
base.OnManipulationCompleted(e);
if (_reorderStarted && Column is not null)
{
_headerRow?.ColumnDropCompleted(Column);
}
_resizeStarted = false;
_resizePreviousStarted = false;
_reorderStarted = false;
}
/// <inheritdoc/>
protected override void OnPointerReleased(PointerRoutedEventArgs e)
{
base.OnPointerReleased(e);
ReleasePointerCaptures();
_resizeStarted = false;
_resizePreviousStarted = false;
_reorderStarted = false;
}
/// <summary>
/// Ensures grid lines are applied.
/// </summary>
internal void EnsureGridLines()
{
if (_v_gridLine is not null && _tableView is not null)
{
_v_gridLine.Fill = _tableView.HeaderGridLinesVisibility is TableViewGridLinesVisibility.All or TableViewGridLinesVisibility.Vertical
? _tableView.VerticalGridLinesStroke : new SolidColorBrush(Colors.Transparent);
_v_gridLine.Width = _tableView.VerticalGridLinesStrokeThickness;
_v_gridLine.Visibility = _tableView.HeaderGridLinesVisibility is TableViewGridLinesVisibility.All or TableViewGridLinesVisibility.Vertical
|| _tableView.GridLinesVisibility is TableViewGridLinesVisibility.All or TableViewGridLinesVisibility.Vertical
? Visibility.Visible : Visibility.Collapsed;
}
}
/// <summary>
/// Gets or sets the column associated with the header.
/// </summary>
public TableViewColumn? Column { get; internal set; }
/// <summary>
/// Gets a value indicating whether the column can be resized.
/// </summary>
private bool CanResize => _tableView?.CanResizeColumns == true && Column?.CanResize == true;
/// <summary>
/// Gets a value indicating whether the column can be sorted.
/// </summary>
private bool CanSort => _tableView?.CanSortColumns is true && Column?.CanSort is true;
/// <summary>
/// Gets a value indicating whether the column can be filtered.
/// </summary>
private bool CanFilter => _tableView?.CanFilterColumns is true && Column?.CanFilter is true;
/// <summary>
/// Gets a value indicating whether the previous column can be resized.
/// </summary>
private bool CanResizePrevious => _headerRow?.GetPreviousHeader(this)?.CanResize == true;
/// <summary>
/// Gets a value indicating whether the cursor is in the sizing area.
/// </summary>
private bool IsSizingCursor => ProtectedCursor is InputSystemCursor { CursorShape: InputSystemCursorShape.SizeWestEast };
}