Binding fails in RowDetailsTemplate of WPF RadGridView

4 posts, 1 answers
  1. Rouf
    Rouf avatar
    4 posts
    Member since:
    Mar 2014

    Posted 06 Jul 2015 Link to this post

    Hi 

    I set ItemSource property of the RadGridView from the code behind as 

     tTaxoGrid.ItemsSource=taxoTable

    The binding occurs in GridViewDataColumns but it fails in RowDetailsTemplate. Following is the XAML I am using. Here txtRemarks is empty.

    Even if I use the same binding property as in GridViewDataColumns (e.g, Species), that also fails displaying in RowDetailsTemplate.

     

    Please assist me in this regard

    Thank you

     

    <Grid.Resources>
                <DataTemplate x:Key="RowDetailsTemplate">
                                        <TextBlock Name="txtRemarks"  Text="{Binding Remarks}" />
                </DataTemplate>
     </Grid.Resources>

     

    <telerik:RadGridView Name="tTaxoGrid"   RowDetailsTemplate="{StaticResource RowDetailsTemplate}" AutoGenerateColumns="False">

                <telerik:RadGridView.Columns>

                      <telerik:GridViewToggleRowDetailsColumn />

                             <telerik:GridViewDataColumn Header="ID" IsVisible="False" DataMemberBinding="{Binding ID}" />

                             <telerik:GridViewDataColumn Header="Species"  DataMemberBinding="{Binding Species}" />

                            <telerik:GridViewDataColumn Header="Common Name" DataMemberBinding="{Binding Common_Name}" />

                             <telerik:GridViewDataColumn Header="Sub Order"  DataMemberBinding="{Binding Sub_Order}" />

                              <telerik:GridViewDataColumn Header="Family"    DataMemberBinding="{Binding Family}" />
           
                </telerik:RadGridView.Columns>

            </telerik:RadGridView>

  2. Answer
    Stefan X1
    Admin
    Stefan X1 avatar
    523 posts

    Posted 07 Jul 2015 Link to this post

    Hello Rouf,

    Can you please share some details about your business model? Is "taxoTable" a DataTable? If it is, can you please try setting the ItemsSource of RadGridView to be DataTable.DefaultView property instead and check if this fixes the issue?

    Additionally, you can check our documentation on RowDetails, as well the RowDetails online demo for further reference.

    Best Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Rouf
    Rouf avatar
    4 posts
    Member since:
    Mar 2014

    Posted 07 Jul 2015 in reply to Stefan X1 Link to this post

    Thank you Stefan!

    yes, ItemsSource property was set to DataTable. Changing it to DataTable.DefaultView solved the problem. I understand that the DefaultView property returns a DataView which we can use to sort, filter, and search a DataTable. It would be great if you shed some light on why DataTable was not working but  DataView. 

    Regards

    Rouf

  5. Stefan X1
    Admin
    Stefan X1 avatar
    523 posts

    Posted 09 Jul 2015 Link to this post

    Hello Rouf,

    I am glad that the proposed approach worked for you.

    DataView implements INotifyCollectionChanged and DataRow implements INotifyPropertyChanged, so I assume that the issue is related to the fact that DataTable does not update its values. The recommended approach when using DataTable with RadGridView is to use its DefaultView property as an ItemsSource.

    Do not hesitate to contact us should you have any other questions on our controls.

    Best Regards,
    Stefan X1
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top