Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/Avalonia.Controls.TreeDataGrid/TreeDataGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,10 @@ internal void RaiseRowPrepared(TreeDataGridRow row, int rowIndex)

internal void RaiseRowDragStarted(PointerEventArgs trigger)
{
if (_source is null || RowSelection is null)
if (!AutoDragDropRows || _source is null || RowSelection is null)
return;

var allowedEffects = AutoDragDropRows && !_source.IsSorted ?
var allowedEffects = !_source.IsSorted ?
DragDropEffects.Move :
DragDropEffects.None;
var route = BuildEventRoute(RowDragStartedEvent);
Expand Down Expand Up @@ -596,8 +596,7 @@ private bool CalculateAutoDragDrop(
[NotNullWhen(true)] out DragInfo? data,
out TreeDataGridRowDropPosition position)
{
if (!AutoDragDropRows ||
e.Data.Get(DragInfo.DataFormat) is not DragInfo di ||
if (e.Data.Get(DragInfo.DataFormat) is not DragInfo di ||
_source is null ||
_source.IsSorted ||
di.Source != _source)
Expand Down Expand Up @@ -628,6 +627,9 @@ _source is null ||

private void OnDragOver(DragEventArgs e)
{
if (!AutoDragDropRows)
return;

if (!TryGetRow(e.Source as Control, out var row))
{
e.DragEffects = DragDropEffects.None;
Expand Down Expand Up @@ -664,11 +666,17 @@ private void OnDragOver(DragEventArgs e)

private void OnDragLeave(RoutedEventArgs e)
{
if (!AutoDragDropRows)
return;

StopDrag();
}

private void OnDrop(DragEventArgs e)
{
if (!AutoDragDropRows)
return;

StopDrag();

if (!TryGetRow(e.Source as Control, out var row))
Expand Down