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

modify column properties at runtime

2 Answers 60 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Bkerby
Top achievements
Rank 1
Bkerby asked on 03 May 2012, 07:15 PM
I have user customizations coming from an external source loaded at runtime (for custom column widths, header text, column visibility).   My columns are defined in XAML and i'm trying to figure out how to intercept the columns as they're being loaded so i can modify them based on the customizations of that user.  I'm trying to avoid dynamically creating the XAML but i can't find an event to hook into to modify the columns.

2 Answers, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 04 May 2012, 07:41 AM
Hi Brian,

Generally, you can work with Columns collection of the grid and update the columns as you require. For example:

(this.myGrid.Columns[1] as GridViewDataColumn).Header = "MyNewHeader";

The exact implementation depends entirely on your specific scenario.
Furthermore, you can set AutoGenerateColumns property of RadGridView to "True" (or leave it to its default value - True) and handle AutoGeneratingColumn event. Thus you can update the state of the column while it is being created. You can take a look at this article for an example on working with the above mentioned event.

Kind regards,
Maya
the Telerik team

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

0
G
Top achievements
Rank 1
answered on 07 May 2012, 09:34 PM
And what event would you best access that from?
Tags
GridView
Asked by
Bkerby
Top achievements
Rank 1
Answers by
Maya
Telerik team
G
Top achievements
Rank 1
Share this question
or