Back to Devexpress

GridControlLocalizer Class

wpf-devexpress-dot-xpf-dot-grid-dbfe6d45.md

latest4.2 KB
Original Source

GridControlLocalizer Class

A base class that provides necessary functionality for custom localizers of the Data Grid control.

Namespace : DevExpress.Xpf.Grid

Assembly : DevExpress.Xpf.Grid.v25.2.Core.dll

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public class GridControlLocalizer :
    DXLocalizer<GridControlStringId>
vb
Public Class GridControlLocalizer
    Inherits DXLocalizer(Of GridControlStringId)

Remarks

Note

Important : Not all strings can be translated via Localizer classes. Some components contain form resources (e.g., the XtraReports Search dialog), and the only way to translate them is to create satellite assemblies. Thus, localization via resources is the preferable solution.

Example

This example uses the GridControlLocalizer to replace the following GridControl‘s strings:

  • Customize… → Customize Totals
  • Totals for ‘Column Name’ → Totals Editor
  • Items → Summary Items

View Example: Use the GridControlLocalizer Class to Localize the Grid

csharp
public partial class MainWindow : Window {
    public MainWindow() {
        // ...
    }
    static MainWindow() {
        GridControlLocalizer.Active = new CustomDXGridLocalizer();
    }
}
public class CustomDXGridLocalizer : GridControlLocalizer {
    protected override void PopulateStringTable() {
        base.PopulateStringTable();
        // Changes the caption of the menu item used to invoke the Total Summary Editor.
        AddString(GridControlStringId.MenuFooterCustomize, "Customize Totals");

        // Changes the Total Summary Editor's default caption.
        AddString(GridControlStringId.TotalSummaryEditorFormCaption, "Totals Editor");

        // Changes the default caption of the tab page that lists total summary items.
        AddString(GridControlStringId.SummaryEditorFormItemsTabCaption, "Summary Items");
    }
}
vb
Public Partial Class MainWindow
    Inherits Window

    Public Sub New()
    ' ...
    End Sub

    Private Shared Sub New()
        GridControlLocalizer.Active = New CustomDXGridLocalizer()
    End Sub
End Class

Public Class CustomDXGridLocalizer
    Inherits GridControlLocalizer

    Protected Overrides Sub PopulateStringTable()
        MyBase.PopulateStringTable()
        ' Changes the caption of the menu item used to invoke the Total Summary Editor.
        AddString(GridControlStringId.MenuFooterCustomize, "Customize Totals")

        ' Changes the Total Summary Editor's default caption.
        AddString(GridControlStringId.TotalSummaryEditorFormCaption, "Totals Editor")

        ' Changes the default caption of the tab page that lists total summary items.
        AddString(GridControlStringId.SummaryEditorFormItemsTabCaption, "Summary Items")
    End Sub
End Class

Inheritance

Object XtraLocalizer XtraLocalizer<GridControlStringId> DXLocalizer<GridControlStringId> GridControlLocalizer

See Also

Localizing WPF Controls with Localizer Objects

GridControlLocalizer Members

DevExpress.Xpf.Grid Namespace