Drag & Drop only for moving items

This commit is contained in:
2026-02-16 13:16:32 +09:00
parent 8484ec4023
commit e19359755e
3 changed files with 5 additions and 49 deletions
-15
View File
@@ -95,26 +95,14 @@ class MainViewModel : BaseViewModel, IFontResolver
Date = DateOnly.FromDateTime(File.GetCreationTime(filePath)),
Notes = "",
FilePath = filePath,
IsMoveDownEnabled = true,
IsMoveUpEnabled = true,
});
}
}
UpdateMoveEnabled();
}
}
}
}
private void UpdateMoveEnabled()
{
for (var i = 0; i < ReportFiles.Count; i++)
{
ReportFiles[i].IsMoveUpEnabled = i != 0;
ReportFiles[i].IsMoveDownEnabled = i != ReportFiles.Count - 1;
}
}
public void MoveItemUp(ReportFile file)
{
var idx = ReportFiles.IndexOf(file);
@@ -127,7 +115,6 @@ class MainViewModel : BaseViewModel, IFontResolver
// So, remove and insert.
ReportFiles.RemoveAt(idx);
ReportFiles.Insert(idx - 1, file);
UpdateMoveEnabled();
}
}
@@ -138,7 +125,6 @@ class MainViewModel : BaseViewModel, IFontResolver
{
ReportFiles.RemoveAt(idx);
ReportFiles.Insert(idx + 1, file);
UpdateMoveEnabled();
}
}
@@ -151,7 +137,6 @@ class MainViewModel : BaseViewModel, IFontResolver
if (idx != -1)
{
ReportFiles.RemoveAt(idx);
UpdateMoveEnabled();
}
}
}