Note that there are some explanatory texts on larger screens.

plurals
  1. PODataBound ListBox and Button inside a ScrollViewer/StackPanel construct, with Button appearing below end of ListBox content
    text
    copied!<p>I have the following construct, which shows a DataBound ListBox and a Button inside a StackPanel, which again is placed inside a ScrollViewer:</p> <pre><code> &lt;ScrollViewer VerticalScrollBarVisibility="Visible" Height="400"&gt; &lt;StackPanel Orientation="Vertical" MaxHeight="400"&gt; &lt;ListBox x:Name="LbTelEntries" SelectionChanged="LbTelEntries_SelectionChanged" MaxHeight="340" VerticalAlignment="Top" ItemsSource="{Binding Path=TelItems}"&gt; &lt;ListBox.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;Templates:ListBoxItemTemplateSelector Content="{Binding}" /&gt; &lt;/DataTemplate&gt; &lt;/ListBox.ItemTemplate&gt; &lt;/ListBox&gt; &lt;Button x:Name="BtMoreTelEntries" Content="More Results" Click="BtMoreTelEntries_Click" Visibility="{Binding Path=NumberRemainingResults, Converter={StaticResource NullToVisConverter}}" HorizontalAlignment="Center" VerticalAlignment="Bottom" Height="70" Width="410" Margin="0 0 0 0" &gt;&lt;/Button&gt; &lt;/StackPanel&gt; &lt;/ScrollViewer&gt; </code></pre> <p>My problem is, that the Button should only appear, when the ListBox is scrolled to the end. Once the Button is clicked, the content of the ListBox is exchanged and the Button should again move to the end of the ListBox...</p> <p>How would I accomplish this?</p> <p>EDIT: I should mention, that I am also implementing an ItemTemplate. See below:</p> <pre><code>&lt;DataTemplate x:Key="ListBoxItemVmTemplate"&gt; &lt;Grid DataContext="{Binding}"&gt; &lt;StackPanel Orientation="Horizontal"&gt; &lt;Border x:Name="UpperListBoxTemplateBorder" Height="42" Width="44" BorderBrush="White" BorderThickness="2.5" CornerRadius="100" Margin="10,16,0,0" VerticalAlignment="Top"&gt; &lt;Path x:Name="DataTemplatePath" Height="16" Width="11" Fill="White" Stretch="Fill" Margin="4,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" UseLayoutRounding="False" Data="M337.59924,129.61948 L337.59924,141.51501 L345.5704,135.87381 z" /&gt; &lt;/Border&gt; &lt;Grid&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="40"&gt;&lt;/RowDefinition&gt; &lt;RowDefinition Height="22"&gt;&lt;/RowDefinition&gt; &lt;/Grid.RowDefinitions&gt; &lt;StackPanel Orientation="Horizontal" Grid.Row="0"&gt; &lt;Controls:EllipsisTextBlock Text="{Binding DataModel.Title}" MaxWidth="410" Margin="18 12 0 0" /&gt; &lt;/StackPanel&gt; &lt;StackPanel Orientation="Horizontal" Grid.Row="1"&gt; &lt;Controls:EllipsisTextBlock Text="{Binding DataModel.Street}" FontSize="16" MaxWidth="410" Margin="18 -3 0 0" /&gt; &lt;Controls:EllipsisTextBlock Text="{Binding DataModel.ZipCode}" FontSize="16" MaxWidth="410" Margin="18 -3 0 0" /&gt; &lt;Controls:EllipsisTextBlock Text="{Binding DataModel.City}" FontSize="16" MaxWidth="410" Margin="18 -3 0 0" /&gt; &lt;/StackPanel&gt; &lt;/Grid&gt; &lt;/StackPanel&gt; &lt;/Grid&gt; &lt;/DataTemplate&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload