In my ListView with buttons for some reason I do not want to work scroll
Here is a listview

<ListView RelativePanel.Below="Sep" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" RelativePanel.AlignBottomWithPanel="True" ScrollViewer.VerticalScrollMode="Enabled" ScrollViewer.VerticalScrollBarVisibility="Hidden" SelectionMode="Single" SelectionChanged="ListBox_SelectionChanged" BorderBrush="White" Foreground="Black" Background="{x:Null}" > <ListViewItem Name="Web" ManipulationMode="TranslateX" ManipulationCompleted="SplitViewPane_ManipulationCompleted"> <StackPanel Orientation="Horizontal"> <Image Name="im2" Source="Resource/Site.png" Height="26" Width="26" /> <TextBlock Name="tx2" FontSize="16" Margin="15,0,0,0">Панель 2</TextBlock> </StackPanel> </ListViewItem> <ListViewItem Visibility="Collapsed" Name="News" ManipulationMode="TranslateX" ManipulationCompleted="SplitViewPane_ManipulationCompleted"> <StackPanel Orientation="Horizontal"> <Image Name="im3" Source="Resource/News.png" Height="26" Width="26" /> <TextBlock Name="tx3" FontSize="16" Margin="15,0,0,0">Панель 3</TextBlock> </StackPanel> </ListViewItem> </ListView> 

Tell me, what could be the trouble? (I suspect it's because of the buttons)

UPD If I pull for the part where there are no buttons, the scroll works enter image description here

And if for the buttons, it ignores enter image description here

  • What do you mean by "does not want to work scroll"? Scrollbars not displayed? Then what? Or is the scrollbar displayed, but its movement does not produce results? Or the wheel does not scroll? - iRumba

2 answers 2

I assume that the ListView is in a StackPanel or in a row of a grid with Height="auto" . Place it in a string with the size Height="*" .

UPD: This is the frame should be.

 <ListView ItemTemplate="ListViewWithButtonsItemTemplate" ItemsSource="{Binding MenuItems}"/> <DataTemplate x:Name="ListViewWithButtonsItemTemplate"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="auto"/> <ColumnDefinition/> </Grid.ColumnDefinitions> <FontIcon Grid.Column="0" Glyph="{Binding Image}"/> <TextBlock Grid.Column="1" Text="{Binding Title}"/> </Grid> </DataTemplate> 
  • I noticed that the scroll does not work if you pull the buttons, and if you drag the parts where there are no buttons, the scroll makes itself felt - Denisok
  • Show the screen how it looks. - Make Makeluv
  • application or code? - Denisok
  • one
    I think the problem is spreading the event. Buttons intercept it and do not let it continue. How to deal with this in this case - xs. I can only advise you to make the buttons humanely, through the ItemTemplate, then everything will definitely work fine. - Make Makeluv
  • one
    If there are more than 5 points, then in the code make a List<MenuItem> , in which MenuItem is a class consisting of 3 properties: string "Icon", string "Button name", string "Address where the button should lead". Bind this List<MenuItem> to the ListView as an ItemsSource and add an ItemTemplate that already has a button layout. In the code, intercept the SelectionChanged event of the list and do what is specified in the "Address" property of the button. - Make Makeluv

I can assume that there is not enough ScrollViewer around the sheet.

 <ScrollViewer> <ListView RelativePanel.Below="Sep" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" RelativePanel.AlignBottomWithPanel="True" ScrollViewer.VerticalScrollMode="Enabled" ScrollViewer.VerticalScrollBarVisibility="Hidden" SelectionMode="Single" SelectionChanged="ListBox_SelectionChanged" BorderBrush="White" Foreground="Black" Background="{x:Null}" > <ListViewItem Name="Web" ManipulationMode="TranslateX" ManipulationCompleted="SplitViewPane_ManipulationCompleted"> <StackPanel Orientation="Horizontal"> <Image Name="im2" Source="Resource/Site.png" Height="26" Width="26" /> <TextBlock Name="tx2" FontSize="16" Margin="15,0,0,0">Панель 2</TextBlock> </StackPanel> </ListViewItem> <ListViewItem Visibility="Collapsed" Name="News" ManipulationMode="TranslateX" ManipulationCompleted="SplitViewPane_ManipulationCompleted"> <StackPanel Orientation="Horizontal"> <Image Name="im3" Source="Resource/News.png" Height="26" Width="26" /> <TextBlock Name="tx3" FontSize="16" Margin="15,0,0,0">Панель 3</TextBlock> </StackPanel> </ListViewItem> </ListView> </ScrollViewer> 

The sheet itself does not contain a ScrollViewer

  • Still as contains. How then does list virtualization work?) - Make Makeluv