Reputation: 1182
I am programming in C# and XAML for the Windows App Store at the moment (Windows 8.1). I have a ListView inside a Semantic Zoom that does not scroll when its items fill up the whole visible place. As I've found out through research it is likely for the issue to have something to do with an enclosing ScrollViewer or statically set Widths and Heights.
Here is the ListView:
<SemanticZoom.ZoomedOutView>
<Hub Header="Overview Panel">
<HubSection>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="120"/>
</Grid.ColumnDefinitions>
<StackPanel VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="1">
<TextBlock Text="All Assignments" FontSize="24"/>
<ListView
ItemTemplate="{StaticResource AssignmentOverviewContentTemplate}"
ItemsSource="{Binding AllAssignmentsList}"
SelectionMode="None">
</ListView>
</StackPanel>
</Grid>
</DataTemplate>
</HubSection>
</Hub>
</SemanticZoom.ZoomedOutView>
</SemanticZoom>
I've also tried adding the following into the ListView or set the Alignments to Stretch but nothing does really work:
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollMode="Disabled"
ScrollViewer.VerticalScrollMode="Enabled"
Can anyone help me out of that? I am sorry if that is a too basic question I haven't really found anything that helped me by now.
Thank you very much!
Upvotes: 2
Views: 3293
Reputation: 1182
I've solved that problem.
It occurs because there is no Space-Limiting-Container inside the DataTemplate. Thus I just had to add a simple grid and everything worked fine:
<Hub Header="Overview Panel">
<HubSection Width="{Binding ScreenWidthFourth}" Header="All Assignments">
<DataTemplate>
<Grid>
<ListView
ItemTemplate="{StaticResource AssignmentOverviewContentTemplate}"
ItemsSource="{Binding AllAssignmentsList}"
SelectionMode="None">
</ListView>
</Grid>
</DataTemplate>
</HubSection>
Pay attention however not to put (in this case) the ListView inside a StackPanel because a StackPanel would give its children unlimited space and thus never enable scrolling.
The problem I still have is that the ListView does not fill all of its vertical space. But since I haven't done any research on that yet, I will open another Thread in case I can't solve that problem.
Thank you anyways :)
Upvotes: 4