Search code examples
listviewwindows-phone-8listboxwindows-phone-8.1stackpanel

Listview/listbox scroll stop work


I need make a layout like this.

<Page>...
    <Grid>
      <Grid..definitions/> 
        <StackPanel>
          ...HeaderScreen Layout here
        <StackPanel>
        <ListView> (or Listbox)
           ... My listItemTemplate here...
        </ListView> (or /Listbox)
    </Grid>
</Page>

In order, when i use this structure the listview is not scrolling. Removing the "StackPanel" block, the scroll work perfectly. I tryied use "Grid", but it is not also working. And i need a fix header on this screen.

EDIT - SOLUTION

My code work when i replace <RowDefinition Height="auto"/> to <RowDefinition Height="*"/>


Solution

  • The ListBox requires a fixed height for the scroll to work. If you have given the ListBox inside a grid row with Height = "Auto" or inside a StackPanel, the ListBox will try to take the size as much as it is needed. This will prevent the scroll. If you have given a fixed height, it will take only that size and displays the rest of the items inside it through scrolling.