ExpandMode Mutiple updating Duplicate data on Child RadGridView

8 posts, 1 answers
  1. Subhendu
    Subhendu avatar
    10 posts
    Member since:
    Mar 2013

    Posted 13 May 2013 Link to this post

    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.

  2. Answer
    Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 13 May 2013 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Subhendu
    Subhendu avatar
    10 posts
    Member since:
    Mar 2013

    Posted 13 May 2013 Link to this post

     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.

  5. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 14 May 2013 Link to this post

    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.

  6. Tingting
    Tingting avatar
    14 posts
    Member since:
    May 2012

    Posted 10 Jan 2014 Link to this post

    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,

  7. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 15 Jan 2014 Link to this post

    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 >>
  8. Tingting
    Tingting avatar
    14 posts
    Member since:
    May 2012

    Posted 15 Jan 2014 Link to this post

    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.



  9. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 15 Jan 2014 Link to this post

    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 >>
Back to Top
UI for WPF is Visual Studio 2017 Ready