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

[Solved] Binding to GroupHeader

2 Answers 75 Views
Grid for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
roodeck
Top achievements
Rank 1
roodeck asked on 19 Jun 2013, 01:48 PM
Is it possible to bind to group header element from my collection which has not been distinguished as a groupedescriptor ?

 
<telerikGrid:RadDataGrid.GroupDescriptors>
          <telerikGrid:PropertyGroupDescriptor PropertyName="Country"/>
 </telerikGrid:RadDataGrid.GroupDescriptors>

I'm trying to do something similar to that :

<local:CustomDataTemplateSelector x:Key="TemplateSelector">           
<
local:CustomDataTemplateSelector.ExpandedTemplate>               
<DataTemplate>                   
  <StackPanel Orientation="Vertical">                       
   <TextBlock Text="{Binding Group.Key}" Foreground="#21A6FF" />     //     "Country"
               
   <Image Source="{Binding IconPath}"   VerticalAlignment="Center"/> // element I would like to add
  </StackPanel
>
</DataTemplate>
</local:CustomDataTemplateSelector.ExpandedTemplate>

<
local:CustomDataTemplateSelector.CollapsedTemplate>
<DataTemplate>
  <
TextBlock Text="{Binding Group.Key}" Foreground="#FFDE5B"  FontStyle="Italic" 
       Margin="115,0,0,0" VerticalAlignment="Center"/>
</DataTemplate>
</local:CustomDataTemplateSelector.CollapsedTemplate>
</local:CustomDataTemplateSelector>

2 Answers, 1 is accepted

Sort by
0
Accepted
Rosy Topchiyska
Telerik team
answered on 21 Jun 2013, 02:50 PM
Hi Piotr,

Thank you for your question.

I have prepared an example project that demonstrates how to customize the group headers: you can create a class that inherits the IValueConverter class and use it to set the Source of the Image element in the Data Template for the expanded state of the CustomDataTemplateSelector.

I hope this was useful and let me know if you need further assistance.

Regards,
Rositsa Topchiyska
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
roodeck
Top achievements
Rank 1
answered on 21 Jun 2013, 03:55 PM
Thank You :)
Tags
Grid for XAML
Asked by
roodeck
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
roodeck
Top achievements
Rank 1
Share this question
or