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

No Tag object in GridViewColumn

1 Answer 133 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mydatafactory
Top achievements
Rank 1
Mydatafactory asked on 06 Sep 2010, 10:37 AM
Hi all,

In my application I use a grid in which I build the columns dynamically from code. I would like to store some extra information (metadata) for each of these columns. Before Q2 2010 I used the FieldAlias property for this, but that is not a correct use of that field. Also the FieldAlias property is now obsolete in the new release.

The best way would be to use a Tag object, but strangely enough there is no Tag property for GridViewColumn. There is a Tag property for the GridView itself and for all the GridViewRows, but not for GridViewColumn...

So why is there no Tag property for GridViewColumn? Is there an other good way to store metadata objects for gridview columns?

Thanks,
A. Bennen

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 07 Sep 2010, 03:09 PM
Hello A.,

Thank you for this question.

We try to keep our API and behavior to be similar with MS controls. This allows us to provide easy migration and interoperability between both frameworks. That is why we have not implemented the Tag property. Nevertheless, the Telerik Presentation Framework (TPF), that we used to create all our controls is inspired by WPF and contains extensibility features like our dependency property system. This mechanism allows attaching a dependency property to any object. You should use the SetValue method for this purpose. You can access the stored value by using the GetValue method. 

Please consider the following code snippet:

GridViewDataColumn col = new GridViewTextBoxColumn();
col.SetValue(LightVisualElement.TagProperty, 100);
int metaData = (int)col.GetValue(LightVisualElement.TagProperty);

We will consider adding such property in one of our upcoming releases.

I hope this helps. do not hesitate to write me back if you have further questions.

Greetings,
Jack
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
Tags
GridView
Asked by
Mydatafactory
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or