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

CellStyleSelector on-the-fly

1 Answer 74 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Guru
Top achievements
Rank 2
Guru asked on 03 Jul 2012, 10:15 PM
My goal is to take a datatable based (dynamic, unknown column names or row values until runtime) gridview and apply formatting or cell styling (column foreground, background, font weight, text wrapping and column width) from settings the user defines. When I generate my columns (GridViewBoundColumnBase) I see that background color is simple but changing the font weight or color seems a mystery...

From what I have read it would be achieved with some sort of converter and datatemplate. Any documentation or examples that could assist me complete this task that actually uses a datatable and could do font weight, color, column background color and text wrapping etc...? I don't want to reinvent the wheel if as much as possible.

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitrina
Telerik team
answered on 04 Jul 2012, 11:14 AM
Hello,

You could define a simple style to apply colours, font size and font weight. If you need to wrap the displayed text though, you will need to use a DataTemplate and set the TextWrapping to the corresponding element
inside. I would suggest you to check this help article about CellStyleSelector and this help article about CellTemplateSelector.  You could as well check this and this online demos.

Greetings,
Didie
the Telerik team

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

Tags
GridView
Asked by
Guru
Top achievements
Rank 2
Answers by
Dimitrina
Telerik team
Share this question
or