0
我有一個全景項TextWrapping不工作水平的StackPanel
<controls:PanoramaItem Header="Stream" Margin="0,-16,0,0">
<ListBox Margin="0,-16,0,0" ItemsSource="{Binding Items}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="6,0,0,10">
<StackPanel Margin="6,0,0,10" Orientation="Horizontal">
<Image Source="{Binding ProfileImage}"
VerticalAlignment="Top"
Margin="0,4,0,0"
Width="48" Height="48"
/>
<!-- This doesn't work -->
<TextBlock Text="{Binding ProfileName}"
TextWrapping="Wrap"
Style="{StaticResource PhoneTextTitle2Style}"/>
<TextBlock Text="{Binding RelativeTime}"
Margin="2,10,0,2"
Style="{StaticResource PhoneTextSubtleStyle}"/>
</StackPanel>
<!-- This works -->
<StackPanel Margin="0,-4,0,17" Orientation="Vertical">
<TextBlock Text="{Binding Content}"
TextWrapping="Wrap"
Style="{StaticResource PhoneTextNormalStyle}"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</controls:PanoramaItem>
我需要ProfileName
文本換行,我想,如果可能的話,使RelativeTime
浮動權。
我該怎麼辦?
你不應該需要嵌套的StackPanels。始終嘗試使用最簡單的XAML,而不使用不必要的元素。 –