New to Telerik UI for WinForms? Download free 30-day trial

Localization

To localize RadPropertyGrid to display control text and messages in a specific language, please consider the following:

  • All required classes for localization are defined in Telerik.WinConrtols.UI.Localization namespace.

  • Start by creating a descendant of the PropertyGridLocalizationProvider class.

  • Override the GetLocalizedString(string id) method and provide a translation for the label and user messages. If a translation is not provided, the default value will be returned. This behavior is guaranteed by the call to the base GetLocalizedString method in the default clause of the switch statement in the example.

Below is a sample implementation of an English localization provider:

Creating English Localization Provider

public class MyEnglishPropertyGridLocalizationProvider : PropertyGridLocalizationProvider
{
    public override string GetLocalizedString(string id)
    {
        switch (id)
        {
            case PropertyGridStringId.ContextMenuReset: return "Reset";
            case PropertyGridStringId.ContextMenuEdit: return "Edit";
            case PropertyGridStringId.ContextMenuExpand: return "Expand";
            case PropertyGridStringId.ContextMenuCollapse: return "Collapse";
            case PropertyGridStringId.ContextMenuShowDescription: return "Show description";
            case PropertyGridStringId.ContextMenuShowToolbar: return "Show toolbar";
            case PropertyGridStringId.ContextMenuSort: return "Sorta";
            case PropertyGridStringId.ContextMenuNoSort: return "No Sort";
            case PropertyGridStringId.ContextMenuAlphabetical: return "Alphabetical";
            case PropertyGridStringId.ContextMenuCategorized: return "Categorized";
            case PropertyGridStringId.ContextMenuCategorizedAlphabetical: return "Categorized Alphabetical";
        }
        return base.GetLocalizedString(id);
    }
}

Public Class MyEnglishPropertyGridLocalizationProvider
    Inherits PropertyGridLocalizationProvider
    Public Overrides Function GetLocalizedString(ByVal id As String) As String
        Select Case id
            Case PropertyGridStringId.ContextMenuReset
                Return "Reset"
            Case PropertyGridStringId.ContextMenuEdit
                Return "Edit"
            Case PropertyGridStringId.ContextMenuExpand
                Return "Expand"
            Case PropertyGridStringId.ContextMenuCollapse
                Return "Collapse"
            Case PropertyGridStringId.ContextMenuShowDescription
                Return "Show description"
            Case PropertyGridStringId.ContextMenuShowToolbar
                Return "Show toolbar"
            Case PropertyGridStringId.ContextMenuSort
                Return "Sort"
            Case PropertyGridStringId.ContextMenuNoSort
                Return "No Sort"
            Case PropertyGridStringId.ContextMenuAlphabetical
                Return "Alphabetical"
            Case PropertyGridStringId.ContextMenuCategorized
                Return "Categorized"
            Case PropertyGridStringId.ContextMenuCategorizedAlphabetical
                Return "Categorized Alphabetical"
        End Select
        Return MyBase.GetLocalizedString(id)
    End Function
End Class

To apply the custom localization provider, instantiate and assign it to the current localization provider:

Changing the localization provider

PropertyGridLocalizationProvider.CurrentProvider = new MyEnglishPropertyGridLocalizationProvider();

PropertyGridLocalizationProvider.CurrentProvider = New MyEnglishPropertyGridLocalizationProvider()

See Also

In this article