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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid with ObservableCollection ItemsSource: Iterate over records

Thread ID:





105783 Nov 19,2012 11:04 AM UTC Dec 26,2012 10:40 AM UTC WPF 1
Tags: GridControl
Asked On November 19, 2012 11:04 AM UTC


I have a Syncfusion WPF grid with an ObservableColletion<T> as data source with columns A, B, and C.  The grid is grouped and sorted by column A, lets say 3 items in the A group and 5 items in the B group and 2 in the C group.   I want to create a command that will iterate through the records in such a way that the first record under A [0-based index=0] is selected first.  Invoking the command again should highlight the first item in group B
[index=3].  Invoking it a third time the selection and the selected highlight should move to the first item in the C group [index=8].

In the Xaml I have:
SelectedItem="{Binding Item, Mode=TwoWay}"

I would expect that assigning the SelectedItem in the ViewModel in through code would change the selected item and highlight.  This does not seem to work :(

I then tried to select record with index 3 manually by using
- while the highlight changes, I don't know how to get a mapping between the model data and the row index required by GridRangeInfo.Row().

Hope you can help,

Best regards,


Rajasekar G [Syncfusion]
Replied On December 26, 2012 10:40 AM UTC

Hi Friedrich,


Thank you for your interest in Syncfusion products.


We have analyzed your query and you can achieve your requirement by using the following code snippet.


Code snippet[C#]:



We have prepared a sample based on this and it can be download from the following location.

Sample Location: http://www.syncfusion.com/downloads/Support/DirectTrac/102493/GridDataControlSample1122105268.zip


1.       Run the sample.

2.       Click the button AddSelectedRange button to select the first record from group.

And you can map the recordindex and rowindex by using the following code snippet.

Code Snippet[C#]:

//record index from the rowindex
int recordindex = grid.Model.ResolveIndexToRecordPosition(rowindex);
//rowindex from the recordindex
int rowindex = grid.Model.ResolvePositionToIndex(recordindex);

Please let us know if you have any questions.


Raja sekar.G


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon