Windows phone 7 button “borders”

天大地大妈咪最大 提交于 2019-12-22 06:35:37

问题


By default WP7 buttons are surrounded by a black space of 5ish pixels. I'd like to remove this, but I've tried setting the Margin, BorderThickness, Padding properties to be a Thinkness of zero, but this seems to have no effect on this mysterious space. Any clues what exactly this spaces is and how I might get rid of it.

Thanks,

Robert


回答1:


This border is specifically added to increase the size of the button as a touch target. Having this padding makes it easier for people to be sure that they are touching the control they are aiming for.
If you are trying to remove this to fit more controls on the page be aware you're probably making it easier for users to accidentally tap the wrong control.

If you really must do this you must retemplate the button control.

The only difference you need to make to the default template (you can get a copy of this from Blend) is to change the margin on the controller from

 <Border ... Margin="{StaticResource PhoneTouchTargetOverhang}">

to whatever value is appropriate for you.

Please also note that by changing this value you're likely to create issues for yourself when smaller screen devices are introduced.



来源:https://stackoverflow.com/questions/4448293/windows-phone-7-button-borders

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!