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]ASP.NET Core 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]CodeRush Classic
[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 an application that uses a single right-to-left (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 control layouts are automatically reversed when RTL mode is enabled. The image below shows a drop-down button rendered in default and RTL mode.

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

All controls have a RightToLeft property. The default value of this property is Inherit, which means it inherits the setting from the parent control (typically, a form). It is not good practice to enable RightToLeft on a specific control while other controls are aligned left-to-right, because it may lead to layout issues. Instead, always enable right-to-left alignment via a form's RightToLeft or WindowsFormsSettings.RightToLeft property (see below).

Expanded RightToLeftLayout Setting

The RightToLeftLayout property also maintains RTL mode.This property is provided by forms (a standard Form, XtraForm, RibbonForm or TabForm), and several standard and DevExpress controls. The RightToLeftLayout setting applies 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 the form.
Note

The RightToLeft property must be set to Yes for the RightToLeftLayout setting to take effect.

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

Note

At runtime, avoid changing the RightToLeft or RightToLeftLayout property at runtime for forms that are already displayed.

The figure below illustrates a sample RibbonForm displayed in left-to-right and right-to-left locales. Note that the control layout for the right-to-left locale is mirrored.

Certain control containers provide their own RightToLeftLayout settings that activate visual element and child control layout mirroring. In most cases, you need to enable these settings to properly support RTL mode. If a control container (e.g., a standard Windows Forms Panel) does not provide a RightToLeftLayout setting, manually arrange child controls within this container based on 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.

In relation to RTL, there are several advantages to using LayoutControl as a control container within a form. The LayoutControl maintains a consistent layout and supports RTL mode. This mode is automatically activated for the LayoutControl when the form's (or LayoutControl's) RightToLeft property is set to Yes. The image below shows a sample LayoutControl displayed in different locales.

Expanded WindowsFormsSettings Class: Global Settings

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

We recommend that you enable RTL settings via RightToLeft and RightToLeftLayout properties, but if the application is not localizable and primarily uses DevExpress controls, you can also use the WindowsFormsSettings.RightToLeft and WindowsFormsSettings.RightToLeftLayout property 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, as shown in the code snippet below.

Note

The RTL global settings exposed by the WindowsFormsSettings class are not in effect for standard Forms and controls. If you use standard Forms and controls, enable the corresponding RTL settings individually via the RightToLeft and RightToLeftLayout property of each form or control

Note

When using global settings of the WindowsFormsSettings class, you cannot support both left-to-right and right-to-left cultures in a single application, since these settings cause all DevExpress controls to be displayed fromright-to-left. Use these global settings if the 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 these 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 uses 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 copy it into the directory where the application's executable file 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?​​​​​​​