I have tried the above using "gvArea.Items", "gvArea.ItemsSource" and "gvArea.DataContext" with no luck.
Thanks in advance...
3 Answers, 1 is accepted
answered on 30 Apr 2014, 02:28 PM
You can use a lambda expression to traverse the ItemsSource collection of the GridView. Please keep in mind that you will need to cast the collection to the type of the property which provides it with the data.
Area item = (this.xAreasGridView.ItemsSource as ObservableCollection<Area>).FirstOrDefault(f => f.Id == iAreaId);
if (item != null)
this.xAreasGridView.SelectedItem = item;
In this case I have a ObservableCollcetion<Area> Areas property in the ViewModel that is bound to the ItemsSource property of the GridView.
I hope this helps.
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.