Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Modify Captions of Navigation Buttons

  • 2 minutes to read

Note

This article is relevant for versions prior to v2008 vol.2. More recent versions contains the SchedulerNavigationButtonOptions class. Use the following properties: SchedulerNavigationButtonOptions.NextCaption - specifies a text for the Next navigation button; SchedulerNavigationButtonOptions.PrevCaption - specifies a text for the Previous navigation button.

If appointments are not called appointments in your application, then you definitely need to change the caption for navigation buttons. How would you go about doing this?

The answer is simple - localize. All .NET DevExpress controls provide a Localizer class for this purpose.

You should create a DevExpress.XtraScheduler.Localization.SchedulerLocalizer class descendant and override its Localizer.GetLocalizedString property. Then, assign an instance of your class to the SchedulerLocalizer’s static Localizer.Active property. For more information on localizing controls, refer to Localization topic.

The following code snippet illustrates this technique applied to a button’s caption text.

using DevExpress.XtraScheduler.Localization;
//...
public partial class Form1 : Form
{
    public Form1()
    {
        SchedulerLocalizer.Active = new MyLocalizer();
        InitializeComponent();
    }
    public class MyLocalizer : SchedulerLocalizer 
    {
        public override string GetLocalizedString(SchedulerStringId id)
        {
            switch (id)
            {
                case SchedulerStringId.Caption_PrevAppointment:
                    return "Previous Item";
                case SchedulerStringId.Caption_NextAppointment:
                    return "Next Item";
            }
            return base.GetLocalizedString(id);
        }
    }

LocalizeButtonCaptions

Note

Handle the SchedulerControl.CustomDrawNavigationButton event, to paint navigation buttons manually.

See Also