feat: stop changing selection after checking canselect. revert focus change in this case.

This commit is contained in:
Dong Bin
2025-06-12 19:30:14 +08:00
parent 0e83446cb6
commit fb9f03d63b
3 changed files with 19 additions and 9 deletions

View File

@@ -6,19 +6,19 @@ namespace Ursa.Controls;
public class SelectionChangingEventArgs: RoutedEventArgs
{
/// <summary>Gets the items that were added to the selection.</summary>
public IList AddedItems { get; }
public IList NewItems { get; }
/// <summary>Gets the items that were removed from the selection.</summary>
public IList RemovedItems { get; }
public IList OldItems { get; }
/// <summary>
/// Gets or sets a value indicating whether the selection can be changed. If set to <c>false</c>, the selection will not change.
/// </summary>
public bool CanSelect { get; set; } = true;
public SelectionChangingEventArgs(RoutedEvent routedEvent, IList removedItems, IList addedItems): base(routedEvent)
public SelectionChangingEventArgs(RoutedEvent routedEvent, IList oldItems, IList newItems): base(routedEvent)
{
RemovedItems = removedItems;
AddedItems = addedItems;
OldItems = oldItems;
NewItems = newItems;
}
}