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 for Form's Controls, Strings and Images in a Multiple Culture Application

This topic describes how to localize resources (text and images) of your forms and add support for several languages, including those that use a right-to-left writing system. It shows the benefits of using the LayoutControl as a container for your controls in RTL-aware forms.

Assume that support for RTL mode needs to be added for the following UI.

This is a form (XtraForm) that contains an XtraTabControl with a single tab page. This tab page contains a LayoutControl where TextEdit and SimpleButton controls reside.

The following figure demonstrates the result of localization into Hebrew. The steps to perform the localization are shown below.

The Windows Forms Localization Mechanism provided by Visual Studio helps you add support for RTL mode and localize form resources (text and images). This mechanism is based on resource files, which are automatically compiled into satellite assemblies that contain culture-specific data. For greater detail on this localization mechanism, see Globalizing and Localizing Applications on MSDN.

Expanded How to localize a form and enable RTL mode

To enable the localization feature for a particular XtraForm, RibbonForm or TabForm, and to support a right-to-left language, perform the following.

  1. In the Properties window, set the form's Localizable property to true .

  2. From the Language property drop-down, select the required language.

    When the required language is selected, you can specify the form settings that differ from the default culture. The language-specific settings that correspond to the form layout are stored in a form-based resource file that is automatically created by Visual Studio. You can find this file in the Solution Explorer window, underneath the form's file. Typically, the file name includes a suffix that indicates the culture to which the resource file corresponds.

  3. Set the form's RightToLeft property to Yes. This enables RTL mode for the form. All child controls inherit this setting by default.

  4. Set the form's RightToLeftLayout to true to reverse (mirror) the layout of controls on the form. This option is only in effect if the RightToLeft property is set to Yes.

  5. The form's RightToLeftLayout property is not inherited by child control containers. Certain control containers (e.g., the standard Windows Forms TabControl) provide their own RightToLeftLayout property. Enable this property for these control containers.

    Note

    By default, DevExpress container controls are automatically mirrored in RTL mode. Some container controls (e.g., XtraTabControl) provide their own RightToLeftLayout properties of the DefaultBoolean type. By setting this property to False, you can prevent automatic layout mirroring for this control in RTL mode.

  6. If there is a control container on the form that does not support automatic control mirroring, you must manually reverse the layout of controls on that container.

    For instance, automatic control mirroring is not supported by the standard Windows Forms Panel. Thus, if a Panel contains OK/Cancel buttons, you must reverse their order manually.

    A sample Panel in default mode:

    A sample Panel in RTL mode:

    Note that while the text direction is changed, the layout remains left-to-right aligned. To resolve this issue, we suggest you use the LayoutControl as a container for your controls. The LayoutControl automatically reverses the layout when RTL mode is enabled.

    The same UI placed inside a LayoutControl in default mode:

    The same UI placed inside a LayoutControl in RTL mode:

  7. Using the Properties window, provide localized versions of custom strings and images for all controls on the form. These culture-specific property values are automatically preserved in the corresponding form-based resource files.

    To localize stings within message boxes, use non-form-based resource files. For details, see How to: Enable RTL Mode for Non-form-based Interfaces in a Multiple Culture Application.

  8. You may also want to localize predefined text of DevExpress controls and components (e.g., text in a GridControl's column context menu) 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 named based on 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.

These steps showed how to create a RTL-aware form and localize the form's resources. Once the form is displayed on an operating system that uses your target language (Hebrew), the RTL mode is enabled and the UI is automatically translated. You can check the result of the localization by explicitly specifying the UI culture on application startup, as shown in the code snippet below.

Expanded See Also

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