Is it possible to use a DataTemplate for a GridView columns collection?
I want to define my columns once and use it in multiple views
3 Answers, 1 is accepted
0
Maya
Telerik team
answered on 31 Jan 2012, 07:34 AM
Hello Erik,
Generally, you can define a DataTemplate in the Resources section and set it for each column you want afterwards. However, if you need to display different properties in your grid that might not be a good approach. What is the exact scenario that you want to achieve ? Do you want to have same columns with same values or you want to apply different style - like setting a background for example ?
All the best,
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I want to have the same columns with the same values and the same style, and use them in different RadGridViews in different Views
0
Maya
Telerik team
answered on 31 Jan 2012, 05:42 PM
Hello Erik,
In this case you can follow the idea mentioned above - to define DataTemplate in the Resources section, set its Key attribute and use is as CellTemplate for all the column you want.
For example: