This question is locked. New answers and comments are not allowed.
Hi,
I would like to refresh the header background and text at runtime, on a click of a button, without having to regenerate the entire grid.
I managed to change the HeaderCellStyle property, but the change is not visible unless I scroll left or right to hide the modified columns.
How can I make the change appear immidiatly when changed?
Thanks,
Pol
I would like to refresh the header background and text at runtime, on a click of a button, without having to regenerate the entire grid.
I managed to change the HeaderCellStyle property, but the change is not visible unless I scroll left or right to hide the modified columns.
How can I make the change appear immidiatly when changed?
Thanks,
Pol
4 Answers, 1 is accepted
0
Hello,
Didie
the Telerik team
Please check this forum thread.
Greetings,Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Po Ly
Top achievements
Rank 1
answered on 16 Apr 2012, 04:37 PM
Hello Didie,
Thank you for you answer.
However, it seems hard to apply to my senario, as I do not want to change all the headers, but only one. I need to alternate on the fly between 2 styles, and both styles have custom textblocks related to the column data.
I managed to change the style, but the change is not refreshed until the column scrolls out of view.
Here is the normal template:
Here is the special template:
Thanks,
Pol
Thank you for you answer.
However, it seems hard to apply to my senario, as I do not want to change all the headers, but only one. I need to alternate on the fly between 2 styles, and both styles have custom textblocks related to the column data.
I managed to change the style, but the change is not refreshed until the column scrolls out of view.
Here is the normal template:
<
ControlTemplate
x:Key
=
"RegularHeaderStyle"
TargetType
=
"telerik:GridViewHeaderCell"
>
<
StackPanel
Orientation
=
"Vertical"
>
<
Border
BorderThickness
=
"0 0 0 1"
BorderBrush
=
"LightGray"
Height
=
"25"
Background
=
"White"
>
<
TextBlock
Margin
=
"5 5 0 0"
Text
=
" "
>
</
TextBlock
>
</
Border
>
<
Border
BorderThickness
=
"0 0 1 0"
BorderBrush
=
"LightGray"
Margin
=
"0 0 0 2"
Height
=
"75"
>
<
TextBlock
Width
=
"75"
Height
=
"20"
Margin
=
"15 70 -35 -15"
Foreground
=
"Black"
Text
=
"Header Text"
>
<
TextBlock.RenderTransform
>
<
CompositeTransform
Rotation
=
"-90"
/>
</
TextBlock.RenderTransform
>
</
TextBlock
>
</
Border
>
</
StackPanel
>
</
ControlTemplate
>
Here is the special template:
<
ControlTemplate
x:Key
=
"MilestoneHeaderStyle"
TargetType
=
"telerik:GridViewHeaderCell"
>
<
StackPanel
Orientation
=
"Vertical"
>
<
Border
BorderThickness
=
"0 0 0 1"
Grid.ColumnSpan
=
"2"
BorderBrush
=
"LightGray"
Height
=
"25"
Background
=
"White"
>
<
TextBlock
Margin
=
"0 5 0 5"
HorizontalAlignment
=
"Left"
Foreground
=
"Black"
Text
=
"{Binding Path=ManagementVM.MilestoneList[0], Source={StaticResource Locator}}"
>
</
TextBlock
>
</
Border
>
<
Border
BorderThickness
=
"0 0 1 0"
BorderBrush
=
"LightGray"
Margin
=
"0 0 0 2"
Height
=
"75"
>
<
Border.Background
>
<
LinearGradientBrush
EndPoint
=
"0.2,0.56"
StartPoint
=
"0.2,0"
>
<
LinearGradientBrush.GradientStops
>
<
GradientStop
Color
=
"#FFFED8A3"
/>
<
GradientStop
Color
=
"#FFFED08F"
Offset
=
"0.42"
/>
<
GradientStop
Color
=
"#FFFEA449"
Offset
=
"0.43"
/>
<
GradientStop
Color
=
"#FFFEC159"
Offset
=
"1"
/>
</
LinearGradientBrush.GradientStops
>
</
LinearGradientBrush
>
</
Border.Background
>
<
TextBlock
Width
=
"75"
Height
=
"20"
Margin
=
"15 70 -35 -15"
Foreground
=
"Black"
Text
=
"Header Text"
>
<
TextBlock.RenderTransform
>
<
CompositeTransform
Rotation
=
"-90"
/>
</
TextBlock.RenderTransform
>
</
TextBlock
>
</
Border
>
</
StackPanel
>
</
ControlTemplate
>
Thanks,
Pol
0
Hi,
Didie
the Telerik team
Indeed the header will need to be redrawn. There is not a HeaderCellStyleSelector for the GridViewDataColumn.
Regards,Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Po Ly
Top achievements
Rank 1
answered on 17 Apr 2012, 02:44 PM
But why is the change is not refreshed until the column scrolls out of view?