locked
Horizontal GridView scroll not working

    Question

  • Dear All,

    I'm using a GridView to display the letters of an alphabet. By default, the GridView is horizontal, so I see the letters this way:

    a e i m .
    b f j n .
    c g k o .
    d h l p .

    But I'd like to display them in this order:

    a b c d
    e f g h
    i j k l
    m n o p
    . . . .

    So I modified the xaml this way:

    <GridView
    	IsItemClickEnabled="True"                            
    	SelectionMode="None"
    	HorizontalContentAlignment="Center"
    	VerticalContentAlignment="Top"
    	>
    	<GridView.ItemsPanel>
    		<ItemsPanelTemplate>
    			<VariableSizedWrapGrid
    				Orientation="Vertical"
    				MaximumRowsOrColumns="4"
    				HorizontalAlignment="Center"
    				VerticalAlignment="Top"
    				/>
    		</ItemsPanelTemplate>
    	</GridView.ItemsPanel>
    </GridView>
    

    After this modification, scrolling is not working any more. If I change the orientation of the VariableSizedWrapGrid to Vertical, it's working fine.

    I would appreciate any help

    István


    Monday, August 04, 2014 9:56 PM

Answers

  • Hi MilelAk,

    Can't you make the code like this way? Orientation seems the root cause.

                    <ItemsPanelTemplate>
                        <VariableSizedWrapGrid
    				Orientation="Horizontal"
    				MaximumRowsOrColumns="4"
    				HorizontalAlignment="Center"
    				VerticalAlignment="Top"
    				/>
                    </ItemsPanelTemplate>

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, August 05, 2014 5:46 AM
    Moderator

All replies

  • I found one solution, if I wrap the GridView in a ScrollViewer, the vertical scroll is working, but I have a feeling that this is not the right way to do this.


    • Edited by MileIAk Monday, August 04, 2014 10:05 PM
    Monday, August 04, 2014 10:04 PM
  • Hi MilelAk,

    Can't you make the code like this way? Orientation seems the root cause.

                    <ItemsPanelTemplate>
                        <VariableSizedWrapGrid
    				Orientation="Horizontal"
    				MaximumRowsOrColumns="4"
    				HorizontalAlignment="Center"
    				VerticalAlignment="Top"
    				/>
                    </ItemsPanelTemplate>

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, August 05, 2014 5:46 AM
    Moderator