Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Collapse]Build an Application
  [Expand]Choose Application UI
   Data Management Controls
  [Expand]Printing and Exporting
  [Expand]WinForms MVVM
  [Expand]Skins
  [Expand]Localization
  [Collapse]Right-to-Left Layout
    How to: Enable RTL Mode in a Right-to-Left Culture Application
    How to: Enable RTL Mode for Form's Controls, Strings and Images in a Multiple Culture Application
    How to: Enable RTL Mode for Non-form-based Interfaces in a Multiple Culture Application
   Redistribution and Deployment
 [Expand]Controls and Libraries
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Enable RTL Mode in a Right-to-Left Culture Application

This topic shows how to enable Right-to-Left mode in your application that uses a single RTL culture.

To learn how to support multiple cultures and enable RTL mode for one or more cultures in a single application, see How to: Enable RTL Mode for Form's Controls, Strings and Images in a Multiple Culture Application and How to: Enable RTL Mode for Non-form-based Interfaces in a Multiple Culture Application.

Expanded RightToLeft Setting

Right-to-left language support includes the alignment of visual elements from right to left. This feature can be enabled by setting the RightToLeft property to Yes for all forms in your application.

DevExpress controls automatically reverse their layouts when RTL mode is enabled. Below, you can see a drop-down button rendered in default and RTL mode.

You can set the RightToLeft property for your forms at design time or in code (prior to the form display). The code snippet below shows how to enable the RightToLeft setting on the XtraForm.
Note

All controls have their own RightToLeft properties. The default value of a control's RightToLeft property is Inherit, which means inheriting the setting from the parent control (typically, a form). However, enabling the RightToLeft setting on a particular control while other controls on your form remain left-to-right aligned is not recommended. This may lead to layout issues. Always enable the right-to-left alignment using a form's RightToLeft or WindowsFormsSettings.RightToLeft property (see below).

Expanded RightToLeftLayout Setting

One more setting that maintains RTL mode is RightToLeftLayout. This property is provided by forms (the standard Form, XtraForm, RibbonForm and TabForm), and several standard and DevExpress controls. For forms, enabling this property does the following:

  • Reverses the location of the form's standard buttons (Minimize, Maximize and Close), system menu and caption (if the caption was left-aligned).
  • Mirrors the layout of controls on your form.
Note

The RightToLeftLayout setting is only in effect if the RightToLeft property is set to Yes.

Set the RightToLeftLayout property for your forms at design time or in code (prior to the form display). The code below shows how to enable the RightToLeft and RightToLeftLayout settings for a sample RibbonForm.

Note

Avoid changing the RightToLeft and RightToLeftLayout properties at runtime for the forms that are already displayed on screen.

In the figures below, you can see a sample RibbonForm displayed in different locales. Note that the layout of controls in the locale that uses a right-to-left language is mirrored.

Certain control containers provide their own RightToLeftLayout settings that activate visual element and child control layout mirroring. Typically, you need to enable these settings to properly support RTL mode. If a control container (e.g., the standard Windows Forms Panel) does not provide a RightToLeftLayout setting, child controls need to be manually arranged within this container according to the target culture.

Note

By default, DevExpress container controls automatically mirror the layout of their visual elements and child controls in RTL mode (when the form's RightToLeft setting is enabled and the RightToLeftLayout setting is not set to False). If a DevExpress control container provides its own RightToLeftLayout property, you can set this property to False to prevent automatic layout mirroring for this container. The following control containers provide their own RightToLeftLayout settings.

The use of the LayoutControl as a control container within a form has significant advantages RTL-wise (compared to pixel-based control arrangement within a form or panel). The LayoutControl maintains a consistent layout of controls and supports RTL mode (the reverse display of labels and controls). RTL mode is automatically activated for the LayoutControl when the form's or LayoutControl's RightToLeft property is set to Yes. The figures below show a sample LayoutControl displayed in different locales.

Expanded Using the global settings of the WindowsFormsSettings class

The WindowsFormsSettings class exposes static properties that specify various global settings common to all DevExpress Windows Forms controls, including the RTL settings.

We recommend that you enable the RTL settings using forms' RightToLeft and RightToLeftLayout properties, but if your application is not localizable and strongly based on DevExpress controls, you can also use the WindowsFormsSettings.RightToLeft and WindowsFormsSettings.RightToLeftLayout properties to support right-to-left languages. These global settings only affect DevExpress forms and controls, and have priority over the RightToLeft/RightToLeftLayout settings exposed by these forms and controls. Set the WindowsFormsSettings.RightToLeft and WindowsFormsSettings.RightToLeftLayout properties before the main application form is created. See the code snippet below.

Note

The RTL global settings exposed by the WindowsFormsSettings class are not in effect for the standard Forms and controls. If you are using the standard Forms and controls, enable the corresponding RTL settings using the forms'/controls' RightToLeft and RightToLeftLayout properties.

Note

When using the global settings of the WindowsFormsSettings class, you cannot support both left-to-right and right-to-left cultures in a single application, since all DevExpress controls are forcibly displayed from right to left. Use these global settings if your application only supports right-to-left languages.

Expanded Translate DevExpress Predefined Strings

DevExpress controls and components display many predefined string constants (e.g., text in a GridControl's column context menu), which are in English by default . You may want to localize the built-in strings into your own language. This mechanism is described in the Localizing WinForms Controls via Satellite Resource Assemblies document.

The approach described in this topic involves using the Localization Service to get satellite resource assemblies. When the assemblies are downloaded, locate a folder whose name matches the abbreviation of the required culture (e.g., he for the Hebrew culture) and simply copy it into the directory where the executable file of your application is located. No code needs to be written, since the application automatically determines the current culture and loads the appropriate assemblies on startup.

Expanded See Also

How would you rate this topic?​​​​​​​