开发者

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 othe开发者_如何转开发rs. 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.

Reference : http://blogs.imeta.co.uk/nrees/archive/2010/06/29/viewbox-wrappanel-and-a-scalable-ui-for-windows-phone-7.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜