协调菜单项 [英] give coordinate to a menu item

查看:119
本文介绍了协调菜单项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用wpf,并且我有一个带有其菜单项的菜单,并且它可以正常工作.唯一的事情是它不在正确的位置.它在屏幕中间,我希望它在屏幕的左侧.如果是html,它将是一个简单的对齐语句.但由于它在xaml上,我不知道如何指定它.这是我的代码:

I am working with wpf, and i have a menu with its menu items and it works. the only thing is that it''s not in the right place. it''s in the middle of the screen and i want it to be on the left hand side. if it was html it would be a simple alignment statement. but since it on xaml, i don''t know how to specify it. this is my code:

<Menu x:Name="loadsavemenu" Height="30" Width="50" Background="Transparent" >
               <MenuItem x:Name="Loadmenu"  VerticalAlignment="Top"  FontSize="14" Height="30" Width="100" Background="Transparent"   HorizontalAlignment="Left" >
                   <MenuItem.Icon>




水平对齐方式无法正常工作,因为它会套叠一些文本.我想从字面上给它坐标.

有任何帮助吗?




The horizontal alignment does not work properly as it over laps some text. i would like to literally give it coordinates.

any help pls?

推荐答案

似乎您是在MenuItem而不是Menu本身上设置水平和垂直对齐方式.尝试将菜单的Horizo​​ntalAlignment设置为Left.使用WPF,我从未真正需要为控件设置确切的坐标.如果这样不起作用,请尝试发布您的整个xaml,然后我会看一看(编辑您的问题-不要发布回复)
It looks like you are setting the horizontal and vertical alignments on the MenuItem rather than on the Menu itself. Try setting the HorizontalAlignment of the Menu to Left. With WPF i have never really had to set exact coordinates for controls. If this doesn''t work, try posting your whole xaml and I will take a look(Edit your question - don''t post a reply)


这篇关于协调菜单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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