Max*_*lov 33 silverlight layout xaml textblock expression-blend
给定Windows Phone 7.1项目中的格式化文本块:
<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>
Run Code Online (Sandbox Code Playgroud)
它正在VS设计器中正确预览:

它已经在混合中看起来不像我想要的那样:

它看起来就像Blend(好工作Blend团队)在模拟器和真实设备中一样.
什么在8和45之前和之后添加了这些空格?
如何强制我的布局正确显示(如在VS设计器中)?
Jus*_* XL 56
如果你把所有的东西写Runs在同一条线上,空的空间就会消失.基本上,这里的新行是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 Code Online (Sandbox Code Playgroud)

为了建立Justin XL的答案,重要的是你不能在运行标签之间有空格,但标签中的空白本身并不重要......
因此,您可以创建将运行放在单独的行上,但不为结果添加空格:
<!-- Formatted to prevent adding spaces between runs -->
<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 Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16763 次 |
| 最近记录: |