RadRibbonView.ApplicationMenu and RightToLeft

3 Answers 105 Views
RibbonView and RibbonWindow
Dmitry
Top achievements
Rank 1
Iron
Dmitry asked on 01 Nov 2021, 03:54 AM

When set IsRightToLeft in Culture then ApplicationMenu is not correct.

 

3 Answers, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 03 Nov 2021, 03:11 PM

Hello Dmitry,

Usually, this behavior is present because of the way the Windows operation system positions the popup elements. Since the ApplicationMenu is hosted in a Popup control, this position issue is observed. This is controlled via the Windows Handedness settings, and you could follow the steps from this article, in order to change this behavior. Also, there is a feature request logged in our feedback portal, related to this matter.

That said, could you try the steps from the provided article, to see if the issue will be solved?

Regards,
Stenly
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Dmitry
Top achievements
Rank 1
Iron
commented on 08 Nov 2021, 03:55 AM | edited

Article not solved my problem. Problem is offset head of menu versus content menu when RightToLeft (red circle in first post .jpg). When LeftToRight is ok.
I put more details:

MainWindow.xaml
...
            <telerik:RadRibbonView.ApplicationMenu>
                <telerik:ApplicationMenu Width="150">
                    <telerik:RadRibbonButton Text="New" Width="150"/>
                </telerik:ApplicationMenu>
            </telerik:RadRibbonView.ApplicationMenu>

            <Menu VerticalAlignment="Top" Height="18">
                <MenuItem Header="File">
                    <MenuItem Header="Switch Menu Aligment" Command="{Binding SwitchMenuAligmentCommand}"></MenuItem>
                </MenuItem>
            </Menu>
...

MainWindowState.cs
...
        public void SwitchMenuAligmentCommandExecute(object obj)
        {
            var t = typeof(SystemParameters);
            var field = t.GetField("_menuDropAlignment", BindingFlags.NonPublic | BindingFlags.Static);
            if ((bool)field.GetValue(null))
                field.SetValue(null, false);
            else
                field.SetValue(null, true);

        }
...

Attached a video how it work. (rename to .mp4 ext)

0
Stenly
Telerik team
answered on 10 Nov 2021, 04:49 PM

Hello Dmitry,

I have implemented the provided code snippet in a sample project, and the behavior from the provided video is present on my end as well. This happens because of the else conditional check in the SwitchMenuAlignmentCommandExecute method, in which the field's value is set to True. As specified in this MSDN article, is that when setting the _menuDropAlignment's value to True, it will be aligned to the left. With this in mind, could you try removing the mentioned conditional check and see if the issue is still present?

In addition, I have attached the mentioned project, for you to test.

Regards,
Stenly
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Arkady
Top achievements
Rank 1
Iron
Iron
answered on 11 Nov 2021, 03:13 AM | edited on 11 Nov 2021, 03:13 AM

Hi Stenly, I'm Dmitry' colleague. Let me clarify on the issue

1) It is good you can recreate the issue, so we can confirm issue is exist and you able to recreate!

2) What you suggest is dirty workaround to overcome the issue, but is bad practice to change system settings for user from the application. What if another application will be need to change it back ? Who will win ? In any case end-user will lose! Isn't we developing applications for users and trying our best to make them happy ? 

3) I would insist raise that as Telerik bug and to fix it in the next release. As you can see in video provided by Dmitry - it works just fine using system menu but Telerik component has issue. From what I understand issue is there for years and yet nothing done to resolve it ?

PS. We are using paid license with Ultimate license, can provide you id or any other details if need. Appreciate your help to resolve the issue!

Stenly
Telerik team
commented on 15 Nov 2021, 08:34 PM

Hello Arkady,

Indeed, the described behavior is not very convenient, but this is something that relates to the way WPF implements its Popup elements positioning. The alignment of the Popup in relation to its owner is determined by the Handedness setting of the OS. This behavior is observed in any control in WPF that uses Popups, whether it is a native or a Telerik one. Changing this behavior on Telerik's side will mean replacing all Popup with another element type which will cause two major issues - a breaking change in the corresponding control and lack of built-in features coming from the Popup (like showing on top of other elements).

In the video provided by Dmitry, both the Telerik component and the WPF native menu behave the same. When changing the menu alignment option, the Telerik menu is positioned aligned to the left relative to its parent (the ribbonview). The menu's drop down is aligned again to the left, but relative to its menu parent.

I am afraid that at this point, the handedness issue is a limitation that comes from the framework and the Handedness setting is the most convenient solution that we can provide. You can read a bit more about this in the following stackoverflow discussion. Note that the code shown in the Popup Content Position article won't change the system setting of the OS, but only the setting in the current application context.

Also, if you have any concrete suggestions on how this can be improved, please don't hesitate to share them.

Regards,
Stenly
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
RibbonView and RibbonWindow
Asked by
Dmitry
Top achievements
Rank 1
Iron
Answers by
Stenly
Telerik team
Arkady
Top achievements
Rank 1
Iron
Iron
Share this question
or