This is a migrated thread and some comments may be shown as answers.

ExpandMode Mutiple updating Duplicate data on Child RadGridView

7 Answers 124 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Subhendu
Top achievements
Rank 1
Subhendu asked on 13 May 2013, 11:24 AM
We have a telerik RadGrid View . Inside the Radgridview data template I have another Rad Grid view which is bidning to a propertey on View Model.

<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

Sort by
0
Accepted
Rossen Hristov
Telerik team
answered on 13 May 2013, 12:29 PM
Hi,

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.

Regards,
Rossen Hristov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Subhendu
Top achievements
Rank 1
answered on 13 May 2013, 03:35 PM
 My assumption was when we expand the row details of another row, this is not going to update the previously selected/expanded row as it's value is already set. This was not clear when we were working with Single Expand Mode as there was no way to validate this scenario.

Thanks for the clarification and it makes sense . We will think of another approach.

0
Rossen Hristov
Telerik team
answered on 14 May 2013, 07:14 AM
Hi,

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.

0
Tingting
Top achievements
Rank 1
answered on 10 Jan 2014, 10:57 AM
I want a RadGridView which has repeated columns in it as you can see in the picture below.

enter image description here

This is just one RadGridView and colums are repeated. How can we do this with wpf RadGridView

Thanks,

0
Dimitrina
Telerik team
answered on 15 Jan 2014, 10:02 AM
Hi,

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
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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 >>
0
Tingting
Top achievements
Rank 1
answered on 15 Jan 2014, 10:44 AM
Hi, 

    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.



0
Dimitrina
Telerik team
answered on 15 Jan 2014, 12:00 PM
Hi,

I am afraid such an option is not supported.

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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 >>
Tags
GridView
Asked by
Subhendu
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Subhendu
Top achievements
Rank 1
Tingting
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or