<sfGrid:SfDataGrid x:Name="dataGrid" AutoGenerateColumns="True" ItemsSource="{Binding OrdersInfo}" SelectionMode="Multiple"> <b:Interaction.Behaviors> <b:BehaviorCollection> <b:EventToCommand Command="{Binding SelectionCommand}" CommandParameter="{x:Reference Name=dataGrid}" EventName="SelectionChanged" /> </b:BehaviorCollection> </b:Interaction.Behaviors> </sfGrid:SfDataGrid> // In ViewModel.cs public ViewModel() { selectionCommand = new Command<SfDataGrid>(onSelectionChanged); selectedItems = new ObservableCollection<object>(); } private Command<SfDataGrid> selectionCommand; public Command<SfDataGrid> SelectionCommand { get { return selectionCommand; } set { selectionCommand = value; } } private ObservableCollection<object> selectedItems; public ObservableCollection<object> SelectedItems { get { return selectedItems; } set { selectedItems = value; } } private void onSelectionChanged(SfDataGrid obj) { //you can get the selected items in the datagrid selectedItems = obj.SelectedItems; } |