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

Bind RadGridView.GroupHeaderTemplate for WPF

2 Answers 46 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ajay
Top achievements
Rank 1
Ajay asked on 23 May 2018, 06:58 AM

Hi,

I have purchased the Telerik license for WPF controls and I am facing issue to bind the RadGridView.GroupHeaderTemplate. I want to bind GroupHeaderTemplate by GroupViewModel but not able to bind. 

I have uploaded sample example at - https://www.dropbox.com/s/1tw9rlv70bgo14b/Telerik%20Example%20-%20GridHeaderTemplate.zip?dl=0

Please find the attached snapshot.

Let  me know we need call so I can explain the issue.

Thanks

2 Answers, 1 is accepted

Sort by
0
Dinko
Telerik team
answered on 25 May 2018, 09:13 AM
Hi Ajay,

Thank you for the provided project.

The reason behind this is that the DataContext of the GroupHeaderTemplate is of type GroupViewModel so the bindings you've set up will not work as there are no TestValue1 and TestValue1 properties in the GroupDescriptor (of type IGroupDescriptor) and Group.Items[0] (of type Customer) members of this class. 
 
In the attached project the HeaderList collection property is set to the MainWindow. If you want to get access to it you can use RelativeSource to get the DataContext of the MainWindow.
<TextBlock Grid.Column="12"
           Margin="20,0,0,0"
           FontSize="12" Text="{Binding DataContext.HeaderList[0].TestValue1,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=telerik:RadGridView}}"/>

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Ajay
Top achievements
Rank 1
answered on 19 Jul 2018, 07:27 AM

Hi,

The issue is resolved. I have used binding as -   Text="{Binding  Group.Items[0].TestObject.FieldName}". 

Thanks,

Ajay

Tags
GridView
Asked by
Ajay
Top achievements
Rank 1
Answers by
Dinko
Telerik team
Ajay
Top achievements
Rank 1
Share this question
or