大家好,我正面临着一个滚动浏览器的奇特功能。
我有这个longlistselector。
<phone:LongListSelector x:Name="ContactsGroupListSelector" Foreground="Black"
Background="Transparent"
ItemTemplate="{StaticResource GroupsItemTemplate}"
LayoutMode="List" IsGroupingEnabled="true"
HideEmptyGroups ="true"
ItemsSource="{Binding Items}"/>
并将其填充此dataTemplate
<DataTemplate x:Key="GroupsItemTemplate">
<StackPanel Orientation="Horizontal">
<Image HorizontalAlignment="Left" Source="{Binding ImageSource}" Width="60" Margin="10,0,8,20" />
<ScrollViewer HorizontalScrollBarVisibility="Auto" Margin="0,0,8,0" VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
<TextBlock Style="{StaticResource PhoneTextExtraLargeStyle}" Foreground="Black" HorizontalAlignment="Left" Text="{Binding Name}" Tap="DisplayTheContactGroupClicked" VerticalAlignment="Top" Margin="0"/>
</ScrollViewer>
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu Background="#FF2A3136" IsZoomEnabled="false">
<toolkit:MenuItem Foreground="White" Header="delete group" Click="Delete" />
</toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>
</StackPanel>
</DataTemplate>
所以问题。 scrollviewer不会滚动整个文本块,但只有一大块,我无法找到原因。 如果我将StackPanel的方向设置为Vertical,它将按预期工作,但不能在水平方向上工作。为什么?