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

[Solved] Get acccess to column from CellTemplate

1 Answer 95 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
BlogReader
Top achievements
Rank 1
BlogReader asked on 27 Apr 2009, 05:05 AM
I have created a DataTemplate with a TextBlock, which I assign to the CellTemplate of multiple columns. The TextBlock has a MouseLeftButtonDown event. Is there any way I can get access to the column in the event handler for the event?

1 Answer, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 27 Apr 2009, 05:42 AM
Hi BlogReader,

You can get the parent cell using our extension methods:

var cell = ((TextBlock)sender).ParentOfType<GridViewCell>();
if(cell != null)
{
   GridViewColumn column = cell.Column;
}

Our extension methods are in Telerik.Windows.Controls namespace.

Sincerely yours,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
BlogReader
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or