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

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

Assume that support for RTL mode is required 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 image is a form localized into Hebrew. The steps to localize the form are detailed 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. See Globalizing and Localizing Applications on MSDN for more information on this localization mechanism.

Expanded How to localize a form and enable RTL mode

Perform the following steps to enable the localization feature for a specific XtraForm, RibbonForm or TabForm, and to support a right-to-left language.

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

  2. Select the required language from the Language property drop-down.

    When the required language is selected, you can specify form settings that differ from the default culture. 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 corresponding culture.

  3. Set the form's RightToLeft property to Yes, which 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 form's control layout. 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 property of the DefaultBoolean type. Set this property to False to 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 control layout of within that container.

    For example, automatic control mirroring is not supported by the standard Windows Forms Panel so if a Panel contains an OK or Cancel button, you must reverse the order manually.

    A sample Panel in default mode:

    A sample Panel in RTL mode:

    Note that while the text direction is changed (the colon appears at the end of the right-to-left directed string), the layout remains left-to-right aligned. Use the LayoutControl as a container for controls to resolve this issue. 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. Set custom localized strings and images for all form controls via the Properties window. These values are automatically saved to the corresponding form-based resource files.

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

  8. You may also want to localize embedded 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 utilizes the Localization Service to obtain satellite resource assemblies. When assemblies are downloaded, locate the folder with the corresponding culture abreviation (e.g., he for the Hebrew culture), and copy it into the application's executable file directory. Additional code does not need to be written, since the application automatically determines the current culture and loads the appropriate assemblies on startup.

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 results 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?​​​​​​​