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

custom GridViewCell visual tree at runtime

1 Answer 64 Views
GridView
This is a migrated thread and some comments may be shown as answers.
igal a
Top achievements
Rank 1
igal a asked on 09 Nov 2009, 06:11 PM

i tried using the GridViewColumn.CellTemplate but i can't change it at runtime,

what i want to do is on the RowLoaded event change the cell visual tree(ComboBox, CheckBox)
based on the type of the object in the Cell.Content

i want to be able to change it for each individual cell
not a whole row/Column


i know that somewhere inside the cell there is a:

{System.Windows.Controls.Border}
and inside of it there is

{Telerik.Windows.Controls.GridView.AlignmentContentPresenter}
and inside of it there is the CellTemplate
but i can't access it from c#

 

i also tried to put in the resources of the GridView, couple of DataTemplates for different types (int,brush,enum)
but it ignors the resources

1 Answer, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 10 Nov 2009, 06:09 AM
Hello igal a,

Better will be if you inherit GridViewDataColumn, override CreateCellElement and return desired control.

Regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
igal a
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or