在列表视图中使元素可水平滚动

时间:2015-02-03 19:25:21

标签: c# xaml listview windows-phone-8.1 win-universal-app

如何使listview在另一个listview中水平滚动?父列表视图是可垂直滚动的。

这是xaml部分

<ListView Visibility="Visible" Loaded="feedList_Loaded"  ShowsScrollingPlaceholders="True" ItemContainerStyle="{StaticResource ModifiedListViewItemContainerStyle}" IsItemClickEnabled="True" x:Name="feedList" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,10,0,0">
                        <ListView.ItemContainerTransitions>
                            <TransitionCollection>
                                <EntranceThemeTransition/>
                                <ReorderThemeTransition/>
                                <RepositionThemeTransition/>
                            </TransitionCollection>
                        </ListView.ItemContainerTransitions>
                        <ListView.ItemsPanel>   
                            <ItemsPanelTemplate>
                                <ItemsStackPanel HorizontalAlignment="Stretch" Margin="0,0,0,60 ">
                                </ItemsStackPanel>
                            </ItemsPanelTemplate>
                        </ListView.ItemsPanel>
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <!--<Border Margin="10,0,10,10" BorderThickness="0,0,0,0" BorderBrush="{StaticResource foreGround}" >-->
                                    <Grid x:Name="feedItemGrid" Width="{Binding ActualWidth, ElementName=feedPivot}" Background="{StaticResource LightBG2}" Margin="0,0,0,10" >
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition/>
                                            <ColumnDefinition Width="70"/>
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                            </Grid.RowDefinitions>
                                              .................
                                            ........
                                             ........
                                            <ListView ShowsScrollingPlaceholders="True" ScrollViewer.HorizontalScrollMode="Enabled" ItemsSource="{Binding attachments.data}" HorizontalAlignment="Stretch"  Visibility="{Binding type, ConverterParameter=photo, Converter={StaticResource mediaVisibility}}" Grid.Row="4" Grid.ColumnSpan="3">
                                           <ListView.Items>
                                             <ItemsPanelTemplate>
                                               <Hub Height="350" HorizontalAlignment="Stretch" Orientation="Horizontal"></Hub>
                                            </ItemsPanelTemplate>
                                          </ListView.Items>
                                           <ListView.ItemTemplate>
                                              <DataTemplate>
                                                  <HubSection VerticalAlignment="Top">
                                                    <DataTemplate>
                                                        <Button x:Name="postImageButton"  Style="{StaticResource GridButton}" VerticalAlignment="Stretch" BorderThickness="0" >
                                                        <Grid>
                                                           <Image x:Name="image1" Source="{Binding media.image.src}" HorizontalAlignment="Left" VerticalAlignment="Top" />
                                                        </Grid>
                                                       </Button>
                                                  </DataTemplate>
                                             </HubSection>
                                        </DataTemplate>
                                  </ListView.ItemTemplate>
                                 </ListView>
                                .............
                                ............

我已尝试将stackpanel,pivot,hub放在子列表视图中,但没有任何效果。

0 个答案:

没有答案