[英]Rezise page header windows phone 7
This is probably quite a simple question but very hard to google! 这可能是一个非常简单的问题,但谷歌很难! I'm loading my header from external content so sometimes it will be longer than others.
我正在从外部内容加载我的标题,所以有时它会比其他内容更长。 What I want is for the font to automatically resize so it fits on the page.
我想要的是字体自动调整大小,使其适合页面。 Any ideas?
有任何想法吗?
<controls:PivotItem Name="Header" Header="some string that can be long" FontStretch="ExtraCondensed">
The easiest way is to use a converter that converts the string length to a font stretch/font size: 最简单的方法是使用转换器将字符串长度转换为字体拉伸/字体大小:
<controls:PivotItem Name="Header" Header="{Binding theString}"
FontStretch="{Binding thestring, Converter={StaticResource stringToFontStretchConverter}}"
FontSize="{Binding thestring, Converter={StaticResource stringToFontSizeConverter}}">
although from a design perspective I wouldn't change the font depending on the string length 虽然从设计角度来看,我不会根据字符串长度更改字体
You should use the ViewBox control and put the Container Control within them. 您应该使用ViewBox控件并将Container Control放在其中。
Reference : http://blogs.imeta.co.uk/nrees/archive/2010/06/29/viewbox-wrappanel-and-a-scalable-ui-for-windows-phone-7.aspx 参考: http : //blogs.imeta.co.uk/nrees/archive/2010/06/29/viewbox-wrappanel-and-a-scalable-ui-for-windows-phone-7.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.