How to set background color of a single cell?

3 posts, 0 answers
  1. Josef
    Josef avatar
    25 posts
    Member since:
    Nov 2010

    Posted 31 May 2012 Link to this post

    Hello team,

    I want to set the background color of a single cell in my gridview.
    The bound object contains a string with the hex value of the color. The property is BackcolorHex.

    <telerik:RadGridView Grid.Row="11" Grid.Column="1" Grid.ColumnSpan="4"
                         ItemsSource="{Binding WorkflowView}"
                         IsEnabled="{Binding ModelController.WorkflowHelper.IsWorkflowEditing,
                                     Converter={StaticResource InvertBoolConv}}">
            <Style x:Key="CellBGStyle" TargetType="telerik:GridViewCell">
                <Setter Property="Background"
                        Value="{Binding Path=BackcolorHex,
                                Converter={StaticResource HexToColorConv}}">
            <telerik:GridViewDataColumn Header="Farbe"
                                        CellStyle="{StaticResource CellBGStyle}"
                                        DataMemberBinding="{Binding Path=BackcolorHex,
                                                            Converter={StaticResource HexToColorConv}}"

    This is my converter function:

    public object Convert(object value, Type targetType, object parameter,
                          CultureInfo culture)
        Brush retVal = new SolidColorBrush(Colors.White);
        if (value != null && value is ModelWorkflow)
            myConverter conv = new myConverter();
            retVal = conv.ToBrush(((ModelWorkflow)value).BackcolorHex);
        return retVal;           

    The string is shown in the cell right. But the backcolor does not change. It's always white. Could you please tell me what i'm doing wrong?

    Thank you very much.

    Best regards from Germany!

  2. Evo
    Evo avatar
    2 posts
    Member since:
    Feb 2014

    Posted 26 Oct 2015 Link to this post

    Hi Josef!

    Did you managed to accomplish this? I'm having a similar problem.

  3. DevCraft R3 2016 release webinar banner
  4. Stefan X1
    Stefan X1 avatar
    484 posts

    Posted 29 Oct 2015 Link to this post

    Hi Josef, Evaristo,

    For such scenario you can use the CellStyleSelector feature, supported by RadGridView.

    You may also find the Cells online example useful on the matter.

    Hope this helps.

    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
Back to Top