How to do in WPF, a StackPanel inside a ScrollViewer (or otherwise in a ListView add the load more button at the bottom of the items)?

So I do:
 <style targettype="ListView">
 <Setter Property="Template">
<Setter methods.Value>
 <ControlTemplate TargetType="ListView">

 <ScrollViewer x:Name="ScrollViewer" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Foreground="{TemplateBinding Foreground}" Padding="{TemplateBinding Padding}">
 <ItemsPresenter />
 <Button Content="More" Name="moreButton"></Button>
</Setter methods.Value>

but the ScrollViewer starts to behave inappropriately. scrolling doesn't work smoothly on one item, and takes the entire stackpanel as a single entity, skipping all the elements.

if, instead of the StackPanel is a Grid with a fixed Height, then it will not.
but Grid doesn't fit, since the height of the ItemsPresenter, of course, unknown in advance
June 14th 19 at 19:05
1 answer
June 14th 19 at 19:07
Question is not clear you need to have your button too scalarvalue it or it needs fixed at the bottom of the control?
<scrollviewer grid.row="1" verticalscrollbarvisibility="Auto">
 <!-- Specify the display template -->
 <controltemplate targettype="{x:Type ScrollViewer}">
 <scrollcontentpresenter> <!-- This is an area where to put the items that will be skalerbare -->
 <!-- Instead of the review you can place a button if you do not want to salinopolis -->
 <scrollbar x:name="PART_VerticalScrollBar" value="{TemplateBinding VerticalOffset}" maximum="{TemplateBinding ScrollableHeight}" viewportsize="{TemplateBinding ViewportHeight}" visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" horizontalalignment="Right" style="{DynamicResource ResourceKey=ScrollBarStyle}">
 <!-- And here is placed all that should scraliontis -->

Find more questions by tags C#WPF