This is a migrated thread and some comments may be shown as answers.

Menu alignment different on two computers

2 Answers 195 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Szczepan
Top achievements
Rank 1
Szczepan asked on 13 Dec 2019, 01:25 PM

I have problem with menu alignment on two another computers with different Windows version but with the same language, the same application.

Our menu is defined in that way:

<telerik:RadMenu Name="mainMenu"
                         VerticalAlignment="Top"
                         HorizontalAlignment="Stretch"                         
                         IsMainMenu="True"
                         FlowDirection="LeftToRight"                          
                         ClickToOpen="True"                          
                         Grid.Row="0" Grid.Column="0">
            <telerik:RadMenuItem Header="Katalog"
                                 SubmenuOpened="RadMenuItem_SubmenuOpened">
                <telerik:RadMenuItem Header="Kategorie">
                    <telerik:RadMenuItem Header="Open"></telerik:RadMenuItem>
                    <telerik:RadMenuItem Header="Refresh"></telerik:RadMenuItem>
                </telerik:RadMenuItem>
                <telerik:RadMenuItem Header="Grupy">
                    <telerik:RadMenuItem Header="Open"></telerik:RadMenuItem>
                    <telerik:RadMenuItem Header="Refresh"></telerik:RadMenuItem>
                </telerik:RadMenuItem>
            </telerik:RadMenuItem>
            <telerik:RadMenuItem Header="Motyw systemowy"
                                 SubmenuOpened="RadMenuItem_SubmenuOpened">
                <telerik:RadMenuItem Header="Crystal Light" IsCheckable="True" IsChecked="{Binding IsCrystalLight, Mode=TwoWay}"/>
                <telerik:RadMenuItem Header="Crystal Dark" IsCheckable="True" IsChecked="{Binding IsCrystalDark, Mode=TwoWay}"/>
                <telerik:RadMenuItem Header="Green Light" IsCheckable="True" IsChecked="{Binding IsGreenLight, Mode=TwoWay}"/>
                <telerik:RadMenuItem Header="Green Dark" IsCheckable="True" IsChecked="{Binding IsGreenDark, Mode=TwoWay}"/>
            </telerik:RadMenuItem>
            <telerik:RadMenuItem Header="Pomoc"
                                 SubmenuOpened="RadMenuItem_SubmenuOpened">
                <telerik:RadMenuItem Header="O programie">
                    <telerik:RadMenuItem.Icon>
                        <Image Source="{telerik:IconResource IconRelativePath=address.png, IconSources={StaticResource IconSources}}" Stretch="None"/>
                    </telerik:RadMenuItem.Icon>
                </telerik:RadMenuItem>
            </telerik:RadMenuItem>
        </telerik:RadMenu>

If I added code to properly align menu on submenu item open like below, the behaviour is also bad.

My code to align submenu:

private void RadMenuItem_SubmenuOpened(object sender, Telerik.Windows.RadRoutedEventArgs e)
        {
            RadMenuItem menuItem = sender as RadMenuItem;
            if (menuItem != null)
            {
                System.Diagnostics.Debug.WriteLine($"menuItem.ActualWidth: {menuItem.ActualWidth}");
                Popup popup = menuItem.ChildrenOfType<Popup>().FirstOrDefault();
                if (popup != null)
                {
                    System.Diagnostics.Debug.WriteLine($"popup.ActualWidth: {popup.ActualWidth}");
                    System.Diagnostics.Debug.WriteLine($"((Grid)popup.Child).ActualWidth: {((Grid)popup.Child).ActualWidth}");
                    popup.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;

                    var popupWidth = ((Grid)popup.Child).ActualWidth;
                    var menuWidth = menuItem.ActualWidth;
                    
                    popup.HorizontalOffset = popupWidth - menuWidth;
                }
            }
        }

It looks like it is invalid left to right support or something else.

Please help.

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Dinko | Tech Support Engineer
Telerik team
answered on 18 Dec 2019, 09:30 AM

Hello Szczepan,

Thank you for the provided images.

This behavior could be observed when you are using the right-hand setup for the Tablet PC Settings. It seems that there are different settings applied to the computers on your side. You can change the Handedness setup by executing explorer shell:::{80F3F1D5-FECA-45F3-BC32-752C152E456E} from the Run dialog (Win + R). This will open the Tablet PC Settings window, the Hardedness is located under the "Other" tab. You can change it to Left-handed and check again if this behavior still appears.

You can also check the Change Windows Handedness Settings in Code Behind KB article which describes how you can change it in code behind.

Regards,
Dinko
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Szczepan
Top achievements
Rank 1
answered on 13 Jan 2020, 09:04 AM
Thank you.
Tags
Menu
Asked by
Szczepan
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Szczepan
Top achievements
Rank 1
Share this question
or