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

RowIndicator background

4 Answers 173 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Steffen
Top achievements
Rank 1
Steffen asked on 28 Apr 2009, 03:26 PM
Hi,


I've got some problems with the GridView style:

1) How can I change the background of a RowIndicator. I tried this but it doesn't works:

 

 

 

 

<Style x:Key="{x:Type telerik:GridViewIndicatorCell}" TargetType="telerik:GridViewIndicatorCell">   
    <Setter Property="Background" Value="{StaticResource GridViewHeaderCellBackgroundBrush}" />   
</Style> 
 
 

 

 

 

 

 

2) How can I change the height of the columns header? This is not working correctly:

 

 

 

 

<Style TargetType="telerik:GridViewHeaderCell">   
    <Setter Property="Height" Value="50" />   
</Style> 
 
 

3) I've tried this:

 

 

 

 

<Style TargetType="{x:Type telerik:GridViewCell}">   
    <Setter Property="OverridesDefaultStyle" Value="False" />   
    <Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />   
    <Style.Triggers>   
        <Trigger Property="Validation.HasError" Value="True">    
            <Setter Property="BorderThickness" Value="1" />    
            <Setter Property="BorderBrush" Value="Red" />   
            <Setter Property="ToolTip" Value="{Binding RelativeSource= {RelativeSource Self},                                                       Path=(Validation.Errors)[0].ErrorContent}" />    
        </Trigger>   
    </Style.Triggers>    
</Style> 
 
 

 

 

 

 

 

 

 

 

but this column doesn't work anymore after that (Cell is empty):

 

 

 

 

<telerik:GridViewColumn>    
<telerik:GridViewColumn.CellStyle>    
<Style TargetType="{x:Type telerik:GridViewCell}">    
    <Setter Property="Template">    
        <Setter.Value>    
            <ControlTemplate TargetType="{x:Type telerik:GridViewCell}">    
                <Border Background="{TemplateBinding Background}"    
                              BorderBrush="{TemplateBinding BorderBrush}"   
                              BorderThickness="{TemplateBinding BorderThickness}">   
                        <Button Style="{StaticResource GridImageButton}"     
                                     Click="Delete_Click">    
                                <Image Source="{StaticResource Delete}" />    
                        </Button>   
                </Border>     
            </ControlTemplate>    
        </Setter.Value>    
    </Setter>    
</Style>    
</telerik:GridViewColumn.CellStyle>    
</telerik:GridViewColumn> 
 

 

 

 

 

 

 

 

 

 

Do you know why?

Thanks,

Xavier.

 

 

 

 

 

 

 

 

 

4 Answers, 1 is accepted

Sort by
0
Kalin Milanov
Telerik team
answered on 04 May 2009, 09:21 AM
Hello Xavier,

Apologies for the late reply. Please review the sample solution attached to this reply. I am hopeful this will handle your scenario.

Regards,
Kalin Milanov
the Telerik team

Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
0
Steffen
Top achievements
Rank 1
answered on 05 May 2009, 12:26 PM
Hello Kalin,


Thanks for replying. The solution solve the problems except for two things:

* The up left corner of the grid have always the same color (PART_IndicatorPresenter of the PART_HeaderRow)
* Defining MinHeight of the GridViewHeaderRow works, the PART_GridViewHeaderRowBorder of the template take the correct height but childs doesn't take all the height available so the headers are vertically centered with a empty space up and below.

Xavier.
0
Kalin Milanov
Telerik team
answered on 05 May 2009, 04:39 PM
Hello Xavier,

I will get right to the point:
Try setting a background in the style for the GridViewHeaderRow.
        <Style TargetType="telerik:GridViewHeaderRow"
            <Setter Property="MinHeight" Value="50" /> 
            <Setter Property="Background" Value="#FF0080FF" /> 
        </Style> 
However this will also set the background of the whole HeaderRow to your color. Use this approach if this works for you.

Also, in an updated sample I am sending you the recolored header IndicatorPresenter and an edited template of the header cell so as to set the vertical alignment to whatever you need. 

On another note as a part of an ongoing task to provide easier and more customizations options we will be adding the possibility to control vertical alignment without the need of resorting to template editing. We will also be making a separate Header Indicator part to allow easier styling. 

I hope this works.

Sincerely yours,
Kalin Milanov
the Telerik team

Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
0
Steffen
Top achievements
Rank 1
answered on 11 May 2009, 10:32 AM
It works! Thanks for you help :)
Tags
GridView
Asked by
Steffen
Top achievements
Rank 1
Answers by
Kalin Milanov
Telerik team
Steffen
Top achievements
Rank 1
Share this question
or