Back to Devexpress

GanttLocalizer.GetString(GanttStringId) Method

windowsforms-devexpress-dot-xtragantt-dot-localization-dot-ganttlocalizer-dot-getstring-x28-devexpress-dot-xtragantt-dot-localization-dot-ganttstringid-x29.md

latest2.8 KB
Original Source

GanttLocalizer.GetString(GanttStringId) Method

Returns a caption or a date-time format for the specified visual element.

Namespace : DevExpress.XtraGantt.Localization

Assembly : DevExpress.XtraGantt.v25.2.dll

NuGet Package : DevExpress.Win.Gantt

Declaration

csharp
public static string GetString(
    GanttStringId id
)
vb
Public Shared Function GetString(
    id As GanttStringId
) As String

Parameters

NameTypeDescription
idGanttStringId

A value that specifies a visual element for which to return a caption or date-time format.

|

Returns

TypeDescription
String

A String value that specifies a caption or date-time format.

|

Example

The code below shows how to localize the date-time format for days in the timescale ruler and captions for commands in a Ribbon control.

csharp
using DevExpress.XtraGantt.Localization;

GanttLocalizer.Active = new MyGanttLocalizer();

public class MyGanttLocalizer : GanttLocalizer {
    public override string GetLocalizedString(GanttStringId id) {
        switch (id) {
            case GanttStringId.BothPanelsVisibilityCaption: return "Task List and Chart"; break;
            case GanttStringId.DayFormat: return "dddd, d"; break;
            default: return base.GetLocalizedString(id);
        }
    }
}
vb
Imports DevExpress.XtraGantt.Localization

GanttLocalizer.Active = New MyGanttLocalizer()

Public Class MyGanttLocalizer
    Inherits GanttLocalizer

    Public Overrides Function GetLocalizedString(ByVal id As GanttStringId) As String
        Select Case id
            Case GanttStringId.BothPanelsVisibilityCaption
                Return "Task List and Chart"
            Case GanttStringId.DayFormat
                Return "dddd, d"
            Case Else
                Return MyBase.GetLocalizedString(id)
        End Select
    End Function
End Class

See Also

GanttLocalizer Class

GanttLocalizer Members

DevExpress.XtraGantt.Localization Namespace