Set the Border and the background in a cell style selector

2 posts, 0 answers
  1. Mark
    Mark avatar
    50 posts
    Member since:
    Dec 2010

    Posted 02 Sep 2015 Link to this post

    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. 

     

     

  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 03 Sep 2015 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top