This question is locked. New answers and comments are not allowed.
Jared Pinchot
Top achievements
Rank 1
Jared Pinchot
asked on 29 Jan 2010, 04:28 PM
Is it possible to style the two column header cells created when you have a heirarchy in the grid. I've tried listening to the RowLoaded event and applying the style there, but the cells do not even appear to exist in the header row. I've tried altering the style of the GroupRow but was unable to find the element in the there that I needed to change.
I've attached a picture with cells I'm referring to highlighted.
Any help would be most appreciated
I've attached a picture with cells I'm referring to highlighted.
Any help would be most appreciated
4 Answers, 1 is accepted
0
Hi Jared Pinchot,
The template to alter is the template of GridViewHeaderRow
Within the template - the first "cell" is a Border named PART_IndicatorPresenter
the second "Cell" is the IndentPresenter named "PART_IndentPresenter" - you may need to alter the ItemTemplate of the IndentPresenter .
All the best,
Pavel Pavlov
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
The template to alter is the template of GridViewHeaderRow
Within the template - the first "cell" is a Border named PART_IndicatorPresenter
the second "Cell" is the IndentPresenter named "PART_IndentPresenter" - you may need to alter the ItemTemplate of the IndentPresenter .
All the best,
Pavel Pavlov
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Jared Pinchot
Top achievements
Rank 1
answered on 04 Feb 2010, 11:47 PM
I've tried altering the template as you suggested and it doesnt seem to be applying the template:
Here's the XAML for my control
If I comment out the bulk of the new template (everything except the Border called PART_GridViewHeaderRowBorder) I still see the headers as well as every other part of the control.
I'm currently using version 2009.3.1208.1030 of the controls.
Here's the XAML for my control
| <UserControl x:Class="TradePMR.OMS.Silverlight.Views.People.Components.ExternalAccounts" |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| xmlns:data="clr-namespace:Telerik.Windows.Data;assembly=Telerik.Windows.Data" |
| xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" |
| xmlns:gridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" |
| xmlns:Telerik_Windows_Controls_GridView="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView"> |
| <UserControl.Resources> |
| <telerik:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> |
| <DataTemplate x:Key="GridViewHeaderIndentCellDataTemplate"> |
| <Telerik_Windows_Controls_GridView:GridViewHeaderIndentCell Background="Red"/> |
| </DataTemplate> |
| <ControlTemplate x:Key="GridViewHeaderRowTemplate" TargetType="Telerik_Windows_Controls_GridView:GridViewHeaderRow"> |
| <Border x:Name="PART_GridViewHeaderRowBorder" |
| BorderBrush="Red" |
| Background="Red" |
| BorderThickness="{TemplateBinding BorderThickness}" |
| MinHeight="{TemplateBinding MinHeight}" |
| Margin="{TemplateBinding Margin}" |
| Padding="{TemplateBinding Padding}"> |
| <Telerik_Windows_Controls_GridView:SelectiveScrollingGrid> |
| <Grid.ColumnDefinitions> |
| <ColumnDefinition Width="Auto" /> |
| <ColumnDefinition Width="Auto" /> |
| <ColumnDefinition Width="Auto" /> |
| <ColumnDefinition Width="*" /> |
| </Grid.ColumnDefinitions> |
| <Telerik_Windows_Controls_GridView:DataCellsPresenter x:Name="PART_DataCellsPresenter" MinHeight="{TemplateBinding MinHeight}" |
| Background="{StaticResource GridViewHeaderRowDataCellsPresenterBackground}" |
| Grid.Column="3" /> |
| <Border x:Name="PART_IndicatorPresenter" |
| MinHeight="{TemplateBinding MinHeight}" Width="24" |
| VerticalAlignment="Stretch" |
| BorderBrush="Red" |
| Background="Red" |
| BorderThickness="0,0,1,0" |
| Visibility="{TemplateBinding RowIndicatorVisibility}" |
| Telerik_Windows_Controls_GridView:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" > |
| <Border BorderBrush="Red" Background="Red" BorderThickness="0,0,1,1" /> |
| </Border> |
| <Telerik_Windows_Controls_GridView:IndentPresenter x:Name="PART_IndentPresenter" Grid.Column="1" MinHeight="{TemplateBinding MinHeight}" |
| IndentLevel="{TemplateBinding IndentLevel}" |
| ItemTemplate="{StaticResource GridViewHeaderIndentCellDataTemplate}" |
| Telerik_Windows_Controls_GridView:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" /> |
| <Border x:Name="PART_HierarchyIndentPresenter" Grid.Column="2" MinHeight="{TemplateBinding MinHeight}" Width="24" |
| BorderBrush="Red" |
| BorderThickness="0,0,1,0" |
| Visibility="{Binding HasHierarchy, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" |
| Telerik_Windows_Controls_GridView:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"> |
| <Border BorderBrush="Red" BorderThickness="0,0,1,1" /> |
| </Border> |
| </Telerik_Windows_Controls_GridView:SelectiveScrollingGrid> |
| </Border> |
| </ControlTemplate> |
| <Style x:Key="EAHeaderRowStyle" TargetType="Telerik_Windows_Controls_GridView:GridViewHeaderRow"> |
| <Setter Property="Template" Value="{StaticResource GridViewHeaderRowTemplate}"/> |
| </Style> |
| </UserControl.Resources> |
| <StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> |
| <gridView:RadGridView x:Name="ExternalAccountsList" AutoGenerateColumns="False" |
| ShowGroupPanel="False" RowIndicatorVisibility="Collapsed" |
| HeaderRowStyle="{StaticResource EAHeaderRowStyle}" ColumnsWidthMode="Fill"> |
| <gridView:RadGridView.ChildTableDefinitions> |
| <gridView:GridViewTableDefinition /> |
| </gridView:RadGridView.ChildTableDefinitions> |
| <gridView:RadGridView.GroupDescriptors> |
| <data:GroupDescriptor Member="AccountTypeFormatted"> |
| </data:GroupDescriptor> |
| </gridView:RadGridView.GroupDescriptors> |
| <gridView:RadGridView.Columns> |
| <gridView:GridViewDataColumn DataMemberBinding="{Binding fIName}" Header="Institution"/> |
| <gridView:GridViewDataColumn DataMemberBinding="{Binding accountName}" Header="Account" /> |
| <gridView:GridViewDataColumn DataMemberBinding="{Binding AccountTypeFormatted}" Header="Account Type" |
| Width="100" /> |
| <gridView:GridViewDataColumn DataMemberBinding="{Binding lastUpdateDate}" |
| Header="Last Updated" Width="150" /> |
| <gridView:GridViewDataColumn DataMemberBinding="{Binding ValueFormatted}" Header="Value" |
| Width="100" /> |
| </gridView:RadGridView.Columns> |
| <gridView:RadGridView.HierarchyChildTemplate> |
| <DataTemplate> |
| <gridView:RadGridView ItemsSource="{Binding positions}" ColumnsWidthMode="Fill" AutoGenerateColumns="False" ShowGroupPanel="False" RowIndicatorVisibility="Collapsed"> |
| <gridView:RadGridView.Columns> |
| <gridView:GridViewDataColumn UniqueName="quantity" Header="Quantity" Width="75"> |
| </gridView:GridViewDataColumn> |
| <gridView:GridViewDataColumn UniqueName="symbol" Header="Symbol" Width="75"/> |
| <gridView:GridViewDataColumn UniqueName="name" Header="Description" /> |
| <gridView:GridViewDataColumn UniqueName="price" Header="Market Price" Width="150"> |
| </gridView:GridViewDataColumn> |
| <gridView:GridViewDataColumn UniqueName="value" Header="Value" Width="150"> |
| </gridView:GridViewDataColumn> |
| </gridView:RadGridView.Columns> |
| </gridView:RadGridView> |
| </DataTemplate> |
| </gridView:RadGridView.HierarchyChildTemplate> |
| </gridView:RadGridView> |
| </StackPanel> |
| </UserControl> |
If I comment out the bulk of the new template (everything except the Border called PART_GridViewHeaderRowBorder) I still see the headers as well as every other part of the control.
I'm currently using version 2009.3.1208.1030 of the controls.
0
Hello Jared Pinchot,
Using your XAML , I have gathered a small sample project.
Please find it attached. I have colored the two sqares in question with green.
You will find the two relevenat places in XAML by searching the named color "green".
* please check the version of the dlls as when I tried your XAML with 2009.3.1208.1030 I got some errors which made me thing you might be using a later version ( that is why the example is with a later version)
Greetings,
Pavel Pavlov
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Using your XAML , I have gathered a small sample project.
Please find it attached. I have colored the two sqares in question with green.
You will find the two relevenat places in XAML by searching the named color "green".
* please check the version of the dlls as when I tried your XAML with 2009.3.1208.1030 I got some errors which made me thing you might be using a later version ( that is why the example is with a later version)
Greetings,
Pavel Pavlov
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Jared Pinchot
Top achievements
Rank 1
answered on 11 Feb 2010, 06:36 PM
I managed to get it working using the xaml you provided and explicitly defining the template for the RadGridView, which I had to pull out of the dll using Reflector. For some reason even after upgrading to the 2009_3_1314_1030 it still would not apply the template to the header row, until I explicitly set the template.