@@ -300,6 +300,11 @@ public bool CanPaste
300300 set => SetValue ( CanPasteProperty , value ) ;
301301 }
302302
303+ /// <summary>
304+ /// Identifies the <see cref="ShowDragRectangle"/> dependency property.
305+ /// </summary>
306+ public static readonly DependencyProperty ShowDragRectangleProperty = DependencyProperty . Register ( nameof ( ShowDragRectangle ) , typeof ( bool ) , typeof ( TableView ) , new PropertyMetadata ( true , OnShowDragRectangleChanged ) ) ;
307+
303308 /// <summary>
304309 /// Gets or sets a value indicating whether opening the column filter over header right-click is enabled.
305310 /// </summary>
@@ -365,6 +370,15 @@ public bool ShowFilterItemsCount
365370 set => SetValue ( ShowFilterItemsCountProperty , value ) ;
366371 }
367372
373+ /// <summary>
374+ /// Gets or sets a value indicating whether the drag selection rectangle is shown during cell drag selection.
375+ /// </summary>
376+ public bool ShowDragRectangle
377+ {
378+ get => ( bool ) GetValue ( ShowDragRectangleProperty ) ;
379+ set => SetValue ( ShowDragRectangleProperty , value ) ;
380+ }
381+
368382 /// <summary>
369383 /// Gets or sets a value that indicates whether the TableView should force select the Row or Cell depending on the SelectionUnit
370384 /// </summary>
@@ -404,6 +418,16 @@ public bool ForceRowOrCellSelectionOnContextRequested
404418 /// </summary>
405419 internal bool IsEditing { get ; private set ; }
406420
421+ /// <summary>
422+ /// Gets the canvas that hosts the drag selection rectangle.
423+ /// </summary>
424+ internal Canvas ? DragRectangleCanvas { get ; private set ; }
425+
426+ /// <summary>
427+ /// Gets a value indicating whether a drag selection is currently in progress.
428+ /// </summary>
429+ internal bool IsDragSelecting { get ; private set ; }
430+
407431 /// <summary>
408432 /// Gets the visibility states of details pane for each item.
409433 /// </summary>
@@ -928,6 +952,23 @@ private static void OnIsReadOnlyChanged(DependencyObject d, DependencyPropertyCh
928952 }
929953 }
930954
955+ /// <summary>
956+ /// Handles changes to the ShowDragRectangle property.
957+ /// </summary>
958+ private static void OnShowDragRectangleChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
959+ {
960+ if ( d is TableView tableView && e . NewValue is false )
961+ {
962+ // Hide the rectangle visual but don't stop drag selection or auto-scroll
963+ if ( tableView . _dragRectangle is not null )
964+ {
965+ tableView . _dragRectangle . Visibility = Visibility . Collapsed ;
966+ }
967+
968+ tableView . _dragStartPoint = null ;
969+ }
970+ }
971+
931972 /// <summary>
932973 /// Handles changes to the CanFilterColumns property.
933974 /// </summary>
0 commit comments