Category / Section
How to get first and last selected row index in WPF GridControl?
1 min read
You can get the first and last row index based on the selected ranges in grid using Model.SelectedRanges.Info property of GridModel class. Row selection in GridControl can be enabled by setting GridControl.Model.Options.AllowSelection as Row and GridControl.Model.Options.ListBoxSelectionMode property.
Refer below code for your reference.
C#
private void Button1_Click(object sender, RoutedEventArgs e)
{
if (grid.Model.SelectedRanges.ActiveRange.IsRows)
{
var first = grid.Model.SelectedRanges.Info.Substring(0, 2);
var last = grid.Model.SelectedRanges.Info.Substring(grid.Model.SelectedRanges.Info.Length - 2, 2);
MessageBox.Show("first selected row" + first + Environment.NewLine + "last selected row" + last);
}
}
Sample: View sample in GitHub
Did not find the solution
Contact Support