views:

64

answers:

1

After rendering full grid I need to change data context of selected Row since initially "simple" objects are filled as data source and when single item is selected (looking at RowDetailsVisibilityChanged event), then I want to change DataContext to complex object, that shows much more info in details than in collapsed row.

Using GridViewRowDetailsEventArgs.DetailsElement.DataContext seems to do the trick for Details element that is expanded below row on selecting, BUT Header (Columns) stay the same and values are not updated when changing GridViewRowDetailsEventArgs.DetailsElement.DataContext or GridViewRowDetailsEventArgs.Row.DataCOntext .

(Imagine like column of collapsed row is bound to Name, where Name is "John", and when expanding, Row.DataContext is changed to to object with property Name with "John Dough", but column still shows "John").

A: 

Ok i found a solution and it seems to be pretty simple.

so ... you hook up event handler to RadGridView.RowDetailsVisibilityChanged and in event handler itself you change Item property of provided Row:

private void OnRowDetailsVisibilityChanged(object sender, GridViewRowDetailsEventArgs e)
{
       e.Row.Item = (my New Data);
}

Only problem right now is that row is no longer clickable (details no longer expands when selecting it).

Kestutis