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

Binding fails in RowDetailsTemplate of WPF RadGridView

3 Answers 228 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rouf
Top achievements
Rank 1
Rouf asked on 06 Jul 2015, 09:43 AM

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>

3 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 07 Jul 2015, 02:44 PM
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
0
Rouf
Top achievements
Rank 1
answered on 07 Jul 2015, 09:35 PM

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

0
Stefan
Telerik team
answered on 09 Jul 2015, 04:00 PM
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
Tags
GridView
Asked by
Rouf
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Rouf
Top achievements
Rank 1
Share this question
or