Kuthay Gumus
Kuthay Gumus

Reputation: 764

Windows Store App GridView Horizontal Scrolling

I'm trying to do news app for windows store with c# and xaml..

In this project, I created a Panorama GridView like windows phone 8.. And inside of this Panorama GridView, I created small gridviews for cathegories..

Structure is like this in Document Online;

-<Grid> (whole page)
 -<Grid> (Header/Logo etc.)
 -<PanoramaGridView> (All cath will be under of this)
   -<HotNewsGridView>
     -<HotNewsGrid>
       -<GroupHeaderTextBlock>
       -<HotGridView>
   -<SportNewsGridView>
   -<PoliticsGridView>
   -<GalleryGridView>

And first side of code..

<GridView x:Name="PanoramaGridView" 
                  Grid.Row="1" 
                  Style="{StaticResource GridViewStyle1}" 
                  ItemContainerStyle="{StaticResource GridViewItemStyle2}">
<GridViewItem Margin="0,0,2,0" VerticalAlignment="Top">
                <Grid Margin="30,0,0,0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="80"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <GridView x:Name="HotNewsGrid" 
                              ItemsSource="{Binding}"
                              ItemTemplate="{StaticResource MansetItemTemplate}" 
                              Grid.Row="1"
                              SelectionChanged="HotNewsGrid_SelectionChanged"/>
                    <TextBlock x:Name="GroupHeaderTextBlock"
                               HorizontalAlignment="Left" 
                               Margin="0,0,-7,-18" 
                               Grid.RowSpan="1" 
                               TextWrapping="Wrap" 
                               Text="Hot News" 
                               Foreground="DarkGreen"
                               VerticalAlignment="Top" 
                               Style="{StaticResource SubheaderTextStyle}"/>
                </Grid>

The problem is, I cannot scroll when my mouse cursor come on the "HotNewsGrid" grid. I can only scroll from top and bottom of the application..

I think, my PanoramaGridView is okay with scrolling but when my cursor comes subgridviews (like hot news gridview) it stops scrolling, cannot scroll from it. I tried to put IsSwipeEnable, ScrollViewer.HorizontalScrollMode="Enabled" etc.. Did not worked..

I do not want scrolling the "HotNewsGrid". I just want to continue scrolling when my cursor comes on it..

I hope you understand me.. This is a very big problem for me.. Waiting your helps..

Thank you..

Upvotes: 1

Views: 2308

Answers (1)

Rajeev Bhatia
Rajeev Bhatia

Reputation: 2994

Add this Template to your GridView

<GridView.Template>
    <ControlTemplate>
        <ItemsPresenter />
    </ControlTemplate>
</GridView.Template>

and you will be able to scroll using a mouse.

Note that a side effect of this is that you can no longer swipe select on your GridView

Upvotes: 1

Related Questions