Why OnLoad() called twice when But predefined Load event executes once When Do RightToLeft?

404 Views Asked by At

Something very strange when i search in community. people always said override OnLoad() method because it created Handles and so on. not Predefined event Load

But When doing RightToLeft the OnLoad() called twice unlike Load event which called only once.



Edited

DmitryG explains it well in his answer below.

2

There are 2 best solutions below

0
On BEST ANSWER

From How to: Enable RTL Mode in a Right-to-Left Culture Application:

At runtime, avoid changing the RightToLeft or RightToLeftLayout property at runtime for forms that are already displayed.

Generally, the Right-to-Left layout is not just flipping a screen but this is a massive change that affects the layout of the controls, their texts, images, and other cultural-specific properties and even more. So the handle recreation and then control's reloading may be an expected behavior in this situation.

Anyway, I suggest you contact the DevExpress Support Team in this regard.

PS. The most appropriate way to change the Right-to-Left mode in this situation is restarting your application with updated cultural settings. Take a look at the Application.Restart as a possible way to accomplish this task.

How to: Enable RTL Mode for Form's Controls, Strings and Images in a Multiple Culture Application

2
On

you may try using onrendered(), it is called only once and when the form is completely loaded.