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

Set background in celltemplate

2 Answers 108 Views
GridView
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 23 Sep 2011, 07:48 AM

I have a problem with setting background color of cell.

Currently I have :

<telerik:GridViewDataColumn DataMemberBinding="{Binding Profit}"
                           
IsReadOnly="True" Header="Profit" >
                           
<telerik:GridViewDataColumn.CellTemplate>
                               
<DataTemplate>
                                   
<TextBlock Text="{Binding Profit}" Width="60"  Background="{Binding Color2}"/>
                               
</DataTemplate>

                           
</telerik:GridViewDataColumn.CellTemplate>
                       
</telerik:GridViewDataColumn>

but of cource it doesn't work bacause of setting background at textblock node.

Where I must put

Background="{Binding Color2}"

to have demanding color of cell?

Or it would be great to have solution to set background color for entire row.

Best regards

2 Answers, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 23 Sep 2011, 07:53 AM
Hi John,

I would recommend you to use a RowStyleSelector or CellStyleSelector instead. Please take a look at our online documentation and demos for a reference.
 

All the best,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
John
Top achievements
Rank 1
answered on 23 Sep 2011, 01:04 PM
Thank Maya
Tags
GridView
Asked by
John
Top achievements
Rank 1
Answers by
Maya
Telerik team
John
Top achievements
Rank 1
Share this question
or