具有多个< Run>的TextBlock间距 [英] TextBlock with multiple <Run> spacing
问题描述
给出Windows Phone 7.1项目中的格式化文本块:
Given a formatted text block in Windows Phone 7.1 project:
<StackPanel Orientation="Horizontal">
<TextBlock Foreground="DarkGray" VerticalAlignment="Bottom" Margin="0,0,0,8">
<Run Text="total length "/>
<Run Text="{Binding TotalHours}" FontSize="48"/>
<Run Text="h "/>
<Run Text=":" FontSize="48"/>
<Run Text="{Binding TotalMinutes}" FontSize="48"/>
<Run Text="m "/>
</TextBlock>
</StackPanel>
它已在VS设计器中正确预览:
It is being previewed correctly in VS designer:
它已经看起来不是我在Blend中想要的方式:
It is already looking not the way I want in Blend:
它看起来就像在模拟器和真实设备中的Blend(出色的Blend团队)中一样.
It looks just as in Blend (good job Blend team) in emulator and a real device.
是什么增加了8号和45号前后的空格?
What adds those spaces before and after big 8 and 45?
如何强制布局正确显示(例如在VS设计器中)?
How can I force my layout to look correctly (like in VS designer)?
推荐答案
如果将所有Runs
写在同一行中,则空白将消失.基本上,这里的新行是UI上的空白.
if you write all your Runs
in the same line, the empty space will go away. Basically a new line here is one empty space on the UI.
<TextBlock Foreground="DarkGray" VerticalAlignment="Bottom" Margin="0,0,0,8"><Run Text="total length "/><Run Text="{Binding TotalHours}" FontSize="48"/><Run Text="h "/><Run Text=":" FontSize="48"/><Run Text="{Binding TotalMinutes}" FontSize="48"/><Run Text="m "/></TextBlock>
这篇关于具有多个< Run>的TextBlock间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!