Replies: 1 comment
-
Using Avalonia.Xaml.Behaviors or Attached Properties, bind the SelectionChanged event to a command in the VM, where the command updates the multi-selected items by the args passed in, and then the user uses shift + left mouse click or ctrl + left mouse click to multi-select. public void SelectionChanged(SelectionChangedEventArgs e)
{
if (e.RemovedItems.Count > 0)
{
foreach (var item in e.RemovedItems)
{
if (item is YourOBJ yourOBJ )
{
SelectedOBJs.Remove(yourOBJ);
}
}
}
if (e.AddedItems.Count > 0)
{
foreach (var item in e.RemovedItems)
{
if (item is YourOBJ yourOBJ)
{
SelectedOBJs.Add(yourOBJ);
}
}
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm doing the way to can select multiple row in datagrid, my solution I think is not best, any recomend to improvement ?
This is my approach replace with
I'm using a event check in checkbox custom to allow select multiple row when click checkbox :
and then add custom click event :
It working perfect but it look like hard to follow with mvvm model pattern, anyone done before with another approach can help ?
Beta Was this translation helpful? Give feedback.
All reactions