Selected Row Changed Event

Jun 3, 2009 at 3:44 PM


Some quick help would be appreciated.

I have a DataGrid populated with an entity model:

this.DataGrid.ItemsSource = this.EntityObject.GetAllEntities()

It works fine for me with a simple Entity. I add a child Entity to the form and create a new grid. The new grid should be bound to the child Entity List property:

this.ChildDataGrid.ItemsSource = this.ChildEntityObject.EntityList

Then I Populate the Child Objects EntityList Property with Data Entities


It is automatically populated by my middleware framework in a ParentRetrieved() method.

I have another method in the framework ParentNavigated() in order to requery child data whenever we navigate to another entity in the parent entity list.

I have rigth now two problems:

First, I need to Bind The Grid ItemsSource to the Child Objects EntityList property. Data Entities are stored in an objects EntityList property and this list changes for each parent entity or row.

Second, What is the event that is fired in the Datagrid when I navigate to a diferent row (Click or Key)?

I was thinking that when I selected a diferent row the DataGrid changed the selection of its underlying dataset . When I selelct a different row in the parent DataGrid the child data should be requeried but it doesn´t happen.

So, How can I manage this in order to change the selection programatically? It would fire my navigated event and requey the child data.

Thanks in advance.

Jun 5, 2009 at 11:19 AM

I haven't worked with EntityObjects but with DataSets I know you have to specify IsSynchronizedWithCurrentItem="True" on your grid to change the current item of the collection when the selected item of the grid changes.

Also, there is an event called SelectionChanged on the DataGrid, doesn't it work?