为什么在 XAML & 中创建时菜单项框在左侧对齐?WPF [英] Why Menu Items Box is aligned at left when created in XAML & WPF

查看:19
本文介绍了为什么在 XAML & 中创建时菜单项框在左侧对齐?WPF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 WPF 中创建菜单时,它显示菜单项框左对齐.是否有任何属性使它看起来右侧对齐?(就像windows窗体一样).

When creating a menu in WPF, it shows the menu items box left aligned. Is there any property to make it appear right side aligned? (Like windows forms).

我一直在互联网上搜索但没有成功,感谢您提供的任何帮助.

I have been searching all over internet without success and appreciate any help you could provide.

/* XAML 代码 */

/* XAML CODE */

   <Menu>
        <MenuItem Header="One">
            <MenuItem Header="One-One"></MenuItem>
            <MenuItem Header="One-Two"></MenuItem>
            <MenuItem Header="One-Three"></MenuItem>
            <MenuItem Header="One-Four"></MenuItem>
            <MenuItem Header="One-Five"></MenuItem>
        </MenuItem>
        <MenuItem Header="Two">
            <MenuItem Header="Two-One"></MenuItem>
            <MenuItem Header="Two-Two"></MenuItem>
            <MenuItem Header="Two-Three"></MenuItem>
            <MenuItem Header="Two-Four"></MenuItem>
            <MenuItem Header="Two-Five"></MenuItem>
        </MenuItem>

    </Menu>

推荐答案

问题出在注册表编辑器上.

The problem was on registry editor.

这个网页解决了我的问题:

This web page solved my problem :

http://www.sevenforums.com/教程/786-menus-open-left-right-side.html

在我的情况下,只需删除 HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows 中的MenuDropAlignment"键或将其设置为 0 即可解决问题.

In my case just deleting or setting to 0 the key "MenuDropAlignment" in HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows solved the problem.

希望这个回答能帮助其他有同样问题的人.

Hope this answer helps other people with the same problem.

感谢那些试图提供帮助的人.

And thanks to guys who tried to help.

这篇关于为什么在 XAML &amp; 中创建时菜单项框在左侧对齐?WPF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆