RightToLeft

Wisej.NET supports Right-to-Left and Right-to-Left-Layout (mirroring) quite extensively in most controls, in the themes, in the Theme Builder, and in the designer.

The following controls do not fully support RightToLeft at the moment: DataGridView, ListView, PropertyGrid.

RightToLeft Property

The RightToLeft property makes a control adapt its internal layout and alignment to operate with right-to-left languages. The default value is Inherit which works in most cases. However, an application can force a control to ignore right-to-left mode by setting the value to No or to operate in right-to-left mode by setting the value to Yes.

This property is localizable.

RightToLeftLayout Property

The RightToLeftLayout property mirrors the horizontal position of the direct children of a container. The default value is false.

When set to true, the horizontal layout is mirrored only when the value of RightToLeft resolves to Yes.

This property should be set to false if you don't want Wisej.NET to mirror the layout of your pages and windows when operating in right-to-left mode. Set it to true when you want to mirror the horizontal location of direct children when operating in right-to-left mode.

This property is localizable.

Application.RightToLeft Property

Application.RightToLeft takes its value from the "rightToLeft" Configuration setting or it can be forced to true or false programmatically.

The default value of the Control.RightToLeft property is Inherit, which means that a control inherits the value from its parent. Top level containers and all controls without a parent, when RightToLeft is set to Inherit take the value from the Application.RightToLeft property.

Themes

All Wisej.NET themes support RightToLeft mode. The changes required in a theme to support right-to-left are minimal. When a widget operates in right-to-left mode it has the state "rightToLeft" which allows a theme to adapt the UI to right-to-left.

In most cases there are no changes required. The most typical changes related to right-to-left mode are to mirror icons and to switch the location of a single side border.

For example, icons can be mirrored just by adding this state style:

"rightToLeft":
{
  "styles":
  {
    "transform": "scale(-1, 1)"
  }
},

TreeView arrows that require a 45 degree rotation when expanded and should also be mirrored can adapt to RTL using this states:

"rightToLeft":
{
  "styles":
  {
    "transform": "rotateZ(180deg)"
  }
},
"opened-rightToLeft":
{
  "styles":
  {
    "transform": "rotateZ(135deg)"
  }
},

Notice the composite state in the script above. Using "opened-rightToLeft" qualifies the styles and properties only when the widget has both states set at the same time.

Last updated