Minimum Sizes for Buttons in Windows Phone 8.1

老子叫甜甜 提交于 2020-01-03 08:44:08

问题


Ordinary buttons can not be set smaller than 109 px, RadioButtons not smaller than 168px.

These limits allow only to place 3 buttons or 2 radio buttons horizontally side by side.

Is there a way to make the buttons smaller?


回答1:


Some Controls have set as default MinHeight/MinWidth to ThemeResource value. You may change this value while defining a Control or change its Style - you will find there (for example in Button):

// in Style
// ...
<Setter Property="MinHeight" Value="{ThemeResource PhoneButtonMinHeight}"/>
<Setter Property="MinWidth" Value="{ThemeResource PhoneButtonMinWidth}"/>
// ...

Unless you override those values, the minimum will be honored where there is a conflict - at MSDN:

MinWidth is one of three writable properties on FrameworkElement that specify width information. The other two are MaxWidth and Width. If there is a conflict between these values, the order of application for actual width determination is that first MinWidth must be honored, then MaxWidth, and finally, if it is within bounds, Width. All of these properties are recommendations to the layout behavior of the element's parent in the object tree. The width of the object after layout runs is available as the ActualWidth property value.




回答2:


For button control set MinHeight and MinWidth property for your desired height/width.



来源:https://stackoverflow.com/questions/24259935/minimum-sizes-for-buttons-in-windows-phone-8-1

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