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

Set the Border and the background in a cell style selector

1 Answer 313 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 03 Sep 2015, 01:06 AM

In a follow up from this thread http://www.telerik.com/forums/how-do-i-change-border-color-in-cell-style-selector I need to set both the border and the background of the cell using a cellstyleselector. This is the style so far...

<Style  x:Key="IsEventStyle"
                TargetType="telerik:GridViewCell">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="telerik:GridViewCell">                
                <Border BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}">
                    <ContentPresenter Content="{TemplateBinding Content}"
                                                        ContentTemplate="{TemplateBinding ContentTemplate}" />
                </Border>                  
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="BorderThickness"
                    Value="0.5,1,0.5,1"></Setter>
    <Setter Property="Margin"
                    Value="0,1,0,1" />
    <Setter Property="BorderBrush"
                    Value="Navy"></Setter>
    <Setter Property="VerticalAlignment"
                    Value="Stretch" />
    <Setter Property="HorizontalAlignment"
                    Value="Stretch" />
    <Setter Property="Background"
                    Value="PapayaWhip" />
</Style>

The last setter (background) has no effect.. 

Any help will be appreciated. 

 

 

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 03 Sep 2015, 01:55 PM
Hello Mark,

You should define the Background to the redefined Border directly:
<Border BorderBrush="{TemplateBinding BorderBrush}"
    BorderThickness="{TemplateBinding BorderThickness}" Background="PapayaWhip">


Regards,
Dimitrina
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Mark
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or