RadGridView Header Location for AutoGeneratingColumn

3 posts, 0 answers
  1. VIJIL
    VIJIL avatar
    3 posts
    Member since:
    Jun 2015

    Posted 30 Jun 2015 Link to this post


    How we can apply Localized Header for AutoGeneratingColumn ?

    For example like 

    My xaml contains

    <telerik:RadGridView  x:Name="radGridView" AutoGeneratingColumn="radGridView_AutoGeneratingColumn">

    And cs file contains

    LocalizationManager.Manager = new LocalizationManager() { 
                    ResourceManager = StringLibrary.ResourceManager,
                    Culture = new CultureInfo("es") 

    This is in the constructor part for selecting the the Language.

    Auto generating event as follows

     private void radGridView_AutoGeneratingColumn(object sender, GridViewAutoGeneratingColumnEventArgs e)
                Telerik.Windows.Controls.GridViewDataColumn col = e.Column as Telerik.Windows.Controls.GridViewDataColumn;

               //TODO => if column is some value then i wants to take value from Resourcekey .. This is my requirement.

    How we can do this ?

  2. Stefan
    Stefan avatar
    1073 posts

    Posted 02 Jul 2015 Link to this post

    Hi Vijil,

    I can suggest you following these steps in order to localize a given GridViewDataColumn's header:

    1.   Define a TextBlock as a resource, which would be used as a header.
        <TextBlock x:Key="headerTb" telerik:LocalizationManager.ResourceKey="Key"/>

    2.  Within the event handler of AutoGeneratingColumn event of RadGridView, localize GridViewDataColumns as per your requirements.
    private void clubsGrid_AutoGeneratingColumn(object sender,
        GridViewAutoGeneratingColumnEventArgs e)
        if (e.Column.UniqueName == "Name")
            e.Column.Header = this.Resources["headerTb"] as TextBlock;

    Hope this helps.

    Best Regards,
    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 Feedback Portal and vote to affect the priority of the items
  3. VIJIL
    VIJIL avatar
    3 posts
    Member since:
    Jun 2015

    Posted 03 Jul 2015 in reply to Stefan Link to this post


    Thanks for the reply.

    This looks fine for me.

Back to Top