Search This Blog
Wednesday, June 24, 2015
How to enable a right to left (RTL) layout in XAF WinForms and ASP.NET apps?
Starting with v15.1, certain WinForms controls support the right to left mode:
1. https://community.devexpress.com/blogs/thinking/archive/2015/05/20/what-39-s-right-is-right-and-what-39-s-left-is-left-coming-soon-in-v15-1.aspx
2. https://community.devexpress.com/blogs/thinking/archive/2015/06/23/winforms-right-to-left-support.aspx
An XAF WinForms application is a regular .NET WinForms app that uses DevExpress WinForms controls. Thus, RTL will automatically work for supported controls in XAF. To enable this mode in an XAF WinForms application, handle the XafApplication.CustomizeTemplate event in Program.xx (or override the corresponding virtual method in the WinApplication.xx file) and set the corresponding System.Windows.Forms.Form object properties. You can also additionally override the CreateModelEditorForm method.
1. https://community.devexpress.com/blogs/thinking/archive/2015/05/20/what-39-s-right-is-right-and-what-39-s-left-is-left-coming-soon-in-v15-1.aspx
2. https://community.devexpress.com/blogs/thinking/archive/2015/06/23/winforms-right-to-left-support.aspx
An XAF WinForms application is a regular .NET WinForms app that uses DevExpress WinForms controls. Thus, RTL will automatically work for supported controls in XAF. To enable this mode in an XAF WinForms application, handle the XafApplication.CustomizeTemplate event in Program.xx (or override the corresponding virtual method in the WinApplication.xx file) and set the corresponding System.Windows.Forms.Form object properties. You can also additionally override the CreateModelEditorForm method.
//YourSolutionName.Win/WinApplication.cs
namespace YourSolutionName.Win {
public partial class YourSolutionNameWinApplication : WinApplication {
public void ApplyRightToLeft(System.Windows.Forms.Form form) {
if (form != null) {
form.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
form.RightToLeftLayout = true;
}
}
protected override void OnCustomizeTemplate(DevExpress.ExpressApp.Templates.IFrameTemplate frameTemplate, string templateContextName) {
base.OnCustomizeTemplate(frameTemplate, templateContextName);
ApplyRightToLeft(frameTemplate as System.Windows.Forms.Form);
}
protected override System.Windows.Forms.Form CreateModelEditorForm() {
System.Windows.Forms.Form form = base.CreateModelEditorForm();
ApplyRightToLeft(form);
return form;
}
To enable RTL in XAF ASP.NET WebForms applications, please follow the ASP.NET Controls and MVC Extensions > Common Concepts > Web.config Modifications > Web.config Options > Right to Left Support help article.
It is also possible to enable this mode programmatically via the static DevExpress.Web.ASPxClasses.ASPxWebControl.GlobalRightToLeft property, e.g. per user session as described at S171024. See also: How to enable the rigth to left layout in the View mode for Web Property Editors.
Take special note that so far we have not performed special optimizations or checks at the XAF level for v15.1 and this functionality is automatically derived from our WinForms or ASP.NET components.
We'll plan required R&D in this regard once we confirm real user interest. For now, if you experience any RTL issues when trying the code above only in XAF apps, please report them to us. We'd be happy to discuss their implementation for the future. Also, I recommend you test the newest v15.1.4 build, because it contains a lot of RTL-related fixes in controls.
We'll put any updates on this topic in the How to enable a right to left (RTL) layout in XAF WinForms and ASP.NET apps? article. Your comments on your RTL experience with XAF are also welcome there. Thanks!
Ярлыки:
15.1,
asp.net,
customization,
right to left,
RTL,
UI,
web,
WinForms
Subscribe to:
Post Comments (Atom)
Very informative and It was an awesome post. I love reading your fantastic content. Thanks for sharing it with us. We are so greatful to your sharing.DevExpress Universal
ReplyDelete