This question is locked. New answers and comments are not allowed.
Aurélien Dubosson
Top achievements
Rank 1
Aurélien Dubosson
asked on 28 May 2010, 08:25 AM
Hi everyone,
Is there possible to style specific cells in a gridview ? I would to change the background color of just the first row and the first column, not the others.
Cheers.
Aurélien Dubosson
7 Answers, 1 is accepted
0
Hi Aurélien Dubosson,
The attached example demonstrates one of the possible approaches.
Let me know if you need assistance in adapting this to your project.
Greetings,
Pavel Pavlov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items.
The attached example demonstrates one of the possible approaches.
Let me know if you need assistance in adapting this to your project.
Greetings,
Pavel Pavlov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items.
0
Aurélien Dubosson
Top achievements
Rank 1
answered on 01 Jun 2010, 03:18 PM
Hi Pavel,
Thanks for your answer but the background color of the cell is not linked with the binding.
I just wanted to change background color if is the first row or the first column of my gridview. In the example you get the value of the binding, I want to get the column or row object to test if they are the first .
Cheers,
Aurélien Dubosson
0
Hi Aurélien Dubosson,
You can try this in RowLoaded event instead:
Hope this helps.
All the best,
Veskoni
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items.
You can try this in RowLoaded event instead:
void
RadGridView1_RowLoaded(
object
sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
{
e.Row.Cells[0].SetBinding(GridViewCell.BackgroundProperty,
new
Binding(
"ID"
) { Converter =
new
IDToBackGroundConverter() });
}
Hope this helps.
All the best,
Veskoni
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items.
0
Aurélien Dubosson
Top achievements
Rank 1
answered on 02 Jun 2010, 10:10 AM
I've test that but the problem now I've juste my first column colored . I need the first row too.
Thanks.
Aurélien Dubosson
0
Hello Aurélien Dubosson,
I am a bit confused - I thought this is what you wanted.
The project that we sent you initially did exactly this - colors the first row in red.
Can you attach a screenshot of how do you need it to look like please?
Kind regards,
Veskoni
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items.
I am a bit confused - I thought this is what you wanted.
The project that we sent you initially did exactly this - colors the first row in red.
Can you attach a screenshot of how do you need it to look like please?
Kind regards,
Veskoni
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items.
0
Aurélien Dubosson
Top achievements
Rank 1
answered on 02 Jun 2010, 12:28 PM
Hi Pavel,
Thanks for your help. I wish to have a grid like the grid on my attached file.
Cheers.
Aurélien Dubosson
0
Accepted
Aurélien Dubosson
Top achievements
Rank 1
answered on 02 Jun 2010, 01:17 PM
Hi Pavel,
e.Row.SetBinding(GridViewRowItem.BackgroundProperty, new Binding("Column0") { Converter = new RowBackGroundConverter() });
e.Row.Cells[0].Background = new SolidColorBrush(Colors.Cyan);
I just use the Converter to color my first row.
Best regards.
Aurélien Dubosson