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

Re-label the Filter List RadGrid

3 Answers 62 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 06 Nov 2017, 09:37 PM

Is it possible to change the labels of the different filtering options in a RadGrid?

Specifically, I wanted to change & shorten the words for 'is greater than or equal to'.

I wanted to change this to '>='  just for shorthand.

Can I do this without having to completely customize the control?

I want all the functionality to be exactly the same -- just not the labels.

 

Thanks!

 

David

3 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 09 Nov 2017, 12:30 PM
Hi David,

Thank you for contacting us.

You can change the string using custom localization manager. You can read more about this in the Localization Using Custom Localization Manager section in our documentation. In your case, you to change the IsGreaterThanOrEqualTo you can use the GridViewFilterIsGreaterThanOrEqualTo string.
public class CustomLocalizationManager : LocalizationManager
{      
    public override string GetStringOverride(string key)
    {
        switch (key)
        {
            case "GridViewFilterIsGreaterThanOrEqualTo":
                return ">=";
            default:
                break;
        }
        return base.GetStringOverride(key);
    }
}
public MainWindow()
{
    InitializeComponent();
    LocalizationManager.Manager = new CustomLocalizationManager();
}

Hope this information is helpful for you.

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
0
David
Top achievements
Rank 1
answered on 09 Nov 2017, 12:33 PM

Thank you for the response.  This is helpful.

Do you know if there is a way to conditionally apply the override?

I want to make this adjustment just on one kind of column in my radgrid, but leave the others in tact.

This solution looks to override for the entire grid.  

 

Any suggestions?

Thanks,

David

0
Dinko | Tech Support Engineer
Telerik team
answered on 14 Nov 2017, 11:14 AM
Hello David,

In this particular case, you can subscribe to the FilterOperatorsLoading event of the RadGridView. In the event handler, you can check the current column and change the LocalizationManager.Manager and return to the default one when you have press the filter of other columns. 
public partial class MainWindow : Window
{
    public LocalizationManager DefaultLocalizationManager { get; set; }
    public MainWindow()
    {
        InitializeComponent();
        DefaultLocalizationManager = LocalizationManager.Manager;  
    }
 
    private void grid1_FilterOperatorsLoading(object sender, FilterOperatorsLoadingEventArgs e)
    {
        if (e.Column.Header.ToString() == "FirstName")
        {
            LocalizationManager.Manager = new CustomLocalizationManager();
        }
        else
        {
            if (LocalizationManager.Manager != DefaultLocalizationManager)
            {
                LocalizationManager.Manager = DefaultLocalizationManager;
            }
        }
    }
}

Keep in mind that changing the localization of the RadGridView control runtime is not supported. In order to update the localization strings in the whole control at runtime, you will need to recreate the . In your particular case, it will work for the string in the popup as the content of the popup is still not render in the FilterOperatorsLoading event handler.

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
General Discussions
Asked by
David
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
David
Top achievements
Rank 1
Share this question
or