Search code examples
windows-phone-8longlistselector

Need to scroll LongListSelector horizontally inside a pivotItem?


I want to scroll the LongListSelector Horizontally. This LongListSelector is inside a PivotItem.

I tried to put LongListSelector inside a scrollviewer, but not worked.

           <ScrollViewer  Width="800" HorizontalAlignment="Stretch" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto">

                <Grid x:Name="ContentPanel" HorizontalAlignment="Stretch" VerticalAlignment="Top">

                    <phone:LongListSelector Name="AllImagesList" LayoutMode="Grid"  GridCellSize="220,230" 
                                ItemsSource="{Binding PhotoCollection}"
                                DataContext="{StaticResource viewModel}"
                                ItemTemplate="{StaticResource ImagesItemTemplate}" 
                                SelectionChanged="onImageListSelectionChanged" />

                </Grid>
            </ScrollViewer>

        </controls:PivotItem>

Is it possible to scroll a LongListSelector Horizontally?

If yes, Please help me , How?


Solution

  • Putting something that scrolls horizontally inside a Pivot control is a bad idea.

    The Pivot control will be trying to detect horizontal swipe gestures and so these would be competing with your ScrollViewer. How would the framework know which item you wanted to react to the swipe? How would the person using the app know if their swipe gesture would scroll the list or change the selected pivot item?
    There is a reason this doesn't work.

    As an alternative, if appropriate, you may want to consider using a Panorama control instead as this can have items that are wider than the screen and so support some level of horizontal scrolling. This can't be combined with a vertically scrolling list well though.

    A better approach would probably be to reconsider the design of this page.