<
telerik:RadGridView
>
<
telerik:RadGridView.RowStyle
><!-Style-> <
telerik:RadGridView.RowStyle
>
<
telerik:RadGridView.AlternateRowStyle
><!-Style-> <
telerik:RadGridView.AlternateRowStyle
>
<
telerik:RadGridView.RowDetailsTemplate
>
<
telerik:RadGridView
ItemsSource
=
"{Binding DataContext.VMPOPERTEY, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
AutoGenerateColumns
=
"True"
Name
=
"myGrids"
ColumnWidth
=
"Auto"
IsReadOnly
=
"True"
>
</
telerik:RadGridView.RowDetailsTemplate
>
</
telerik:RadGridView
>
Now the problem is when ever I am expanding an Item , the VMPOPERTEY get set as per the currently expanded item . So the Duplicate values get reflected in all the child elements.
For Example in following figure , when I select Row1 , the row 1 value gets update but the moment I select Row two too (as it expansion mode is multiple) bot Row1 and Row 2 shows the value for Row 2 as this is the last slected row.
7 Answers, 1 is accepted
The idea of the row details in every grid available on the market is to show something from the respective parent row item. That is why the DataContext of the row details element is in fact the data item displayed in its parent row.
Row details are nothing more than an empty rectangle (see Data Templating in WPF) whose DataContext is equal to the parent data item. In other words, the row and the row details share the same data context, so you are free to bind the elements in your data template to any of the properties of the respective data item. What you place inside the row details data template and how you bind it is totally up to you.
You have bound your child grid in a very strange way -- all of your child grids are in fact bound to one and the same thing I guess -- so when this thing changes all of them reflect this. We are not sure why you have decided to bind your child grid like this, but you will get exactly the same results with the stock WPF grid if you try it. In fact, you will get the same behavior with any data binding in WPF.
So, to summarize, the problems you are having are not caused by RadGridView, but by your choice of data binding.
I hope this helps.
Rossen Hristov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Thanks for the clarification and it makes sense . We will think of another approach.
If you assign a value to something from code-behind one time is one thing, but when you have a WPF Binding that binds two things together, it will automatically update those things when one of them changes.
Greetings,Rossen Hristov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.


This is just one RadGridView and colums are repeated. How can we do this with wpf RadGridView
Thanks,
You should just define the columns as many times as you need them to be repeated. If you would like to have one column repeated two times, then you should define/add it two times to the RadGridView.Columns collection.
Regards,
Didie
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>

if I add two times the Column to the RadGridView , the data will be repeated too. I dont want this. For example, i have 100 data, in the left columns of the RadGridView , i want to display 50 of them and in the right columns of the RadGridView i want to display the other 50 data. Knowing that the ItemSource of RadGridView has binded to the 100 data.
I am afraid such an option is not supported.
Regards,
Didie
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>