Re-label the Filter List RadGrid

4 posts, 0 answers
  1. David
    David avatar
    2 posts
    Member since:
    Jun 2014

    Posted 06 Nov Link to this post

    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

  2. Dinko
    Admin
    Dinko avatar
    462 posts

    Posted 09 Nov Link to this post

    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 allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. David
    David avatar
    2 posts
    Member since:
    Jun 2014

    Posted 09 Nov in reply to Dinko Link to this post

    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

  4. Dinko
    Admin
    Dinko avatar
    462 posts

    Posted 14 Nov Link to this post

    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 gridview. 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 allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top