Skip to main content

RightToLeft

WATCH & LEARN0:49 · Animated tutorial
7 scenesPlay, pause, or scrub at your own pace

Wisej.NET supports right-to-left text and layout mirroring in most controls, in themes, in the Theme Builder, and in the designer.

danger

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 for 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
  • Force right-to-left mode by setting the value to Yes

This property is localizable.

RightToLeftLayout Property​

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

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

Set this property to:

  • false to prevent Wisej.NET from mirroring layout in right-to-left mode
  • true to mirror horizontal location of direct children in right-to-left mode

This property is localizable.

Application.RightToLeft Property​

Application.RightToLeft takes its value from:

  • The "rightToLeft" Configuration setting
  • Can be forced to true or false programmatically

The default value of Control.RightToLeft is Inherit, meaning a control inherits the value from its parent. Top-level containers and parentless controls with RightToLeft set to Inherit take their value from Application.RightToLeft.

Themes​

All Wisej.NET themes support right-to-left mode with minimal changes. A widget in this mode has the "rightToLeft" state, which a theme can use to apply the appropriate styles.

Most cases need no changes. Typical right-to-left adjustments include:

  • Mirroring icons
  • Switching single side border location

Example of mirroring icons with a state style:

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

TreeView arrows requiring 45-degree rotation when expanded and mirroring can adapt using these states:

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

The composite state "opened-rightToLeft" qualifies styles and properties only when the widget has both states set simultaneously.