modify column properties at runtime

3 posts, 1 answers
  1. Bkerby
    Bkerby avatar
    9 posts
    Member since:
    Apr 2012

    Posted 03 May 2012 Link to this post

    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. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 04 May 2012 Link to this post

    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 >>

  3. G
    G avatar
    2 posts
    Member since:
    Oct 2011

    Posted 07 May 2012 Link to this post

    And what event would you best access that from?
Back to Top