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

RadGridView Header Location for AutoGeneratingColumn

2 Answers 102 Views
GridView
This is a migrated thread and some comments may be shown as answers.
VIJIL
Top achievements
Rank 1
VIJIL asked on 30 Jun 2015, 01:25 PM

Hi,

How we can apply Localized Header for AutoGeneratingColumn ?

For example like 

My xaml contains

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

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 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 02 Jul 2015, 03:48 PM
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.
<Window.Resources>
    <TextBlock x:Key="headerTb" telerik:LocalizationManager.ResourceKey="Key"/>
</Window.Resources>

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,
Stefan
Telerik
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
0
VIJIL
Top achievements
Rank 1
answered on 03 Jul 2015, 05:23 AM

Hi,

Thanks for the reply.

This looks fine for me.

Tags
GridView
Asked by
VIJIL
Top achievements
Rank 1
Answers by
Stefan
Telerik team
VIJIL
Top achievements
Rank 1
Share this question
or