Robert
Robert

Reputation: 6437

Windows phone 7 button "borders"

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

Upvotes: 5

Views: 2779

Answers (1)

Matt Lacey
Matt Lacey

Reputation: 65564

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.

Upvotes: 3

Related Questions