We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Programmatic control of row selection?

Hi again,

Note that the reason I feel I have to ask this many question on the forum is because, frankly, the documentation for the Xamarin sfDatagrid is not very good at all. Or maybe "non-existent" would be a better way of putting it! While other products have some very complete API documentation, there seems to be littler beyond the Getting Started and the sample code.

At any rate: how to I select a row/column/cell from within the code, as opposed to user touch/tap selection?

is there a sfGrid.SelectRow(5)? Going through the Intellisense and looking at properties, methods etc, I can't seem to find anything that looks like this.


3 Replies

HN Harikrishnan N Syncfusion Team September 14, 2015 12:41 PM UTC

Hi Michael,

Thank you for using Syncfusion Products.

When the SelectionMode is single, you can select a row based on the row index from the code using the SfDataGrid.SelectedIndex property. You can also select an item in SfDataGrid which matches your search item by using the SfDataGrid.SelectedItem property.

When the SelectionMode is Multiple, you can select multiple rows from the code by adding the row objects to the SfDataGrid.SelectedItems collection. Please refer the below code examples.

//When SelectionMode = SelectionMode.Single, Select an item from code based on its RowIndex.

this.SfGrid.SelectedIndex = 4;

// When SelectionMode = SelectionMode.Single, Select an item in SfDataGrid which matches the search item

this.SfGrid.SelectedItem = viewModel.OrdersInfo[4];

//Select items in SfDataGrid from code when selection mode is multiple

Regarding your feedback on documentation, we have already planned to update our UGDocumentation in detail, which includes the API usages and explanation and few basic “How to” sections which will explain about some customizations that can be done in SfDataGrid. Our UGdocuments will be updated in the midst of October, 2015. We appreciate your patience until then.

Please let us know if this helps.


MH Michael Hoffmann September 15, 2015 10:54 PM UTC

Works perfectly, many thanks!

Looking forward to the documentation update.


HN Harikrishnan N Syncfusion Team September 16, 2015 05:50 AM UTC

Hi Michael,

Thank you for your update.

As promised our UG will be updated with API usages and examples in the midst of October, 2015.

Please let us know if you have any query.


Live Chat Icon For mobile
Up arrow icon