I have developed one Visual Studio extension. The problem that I am encountering is the ListView as marked in the snapshot should not go below a certain point. The result here is correct:
The ListView uses as much space as required to display 10 items. But when I shrink the window(Visual Studio extension) as shown here:
Next button is over the ListView & Previous button is under the ListView. The expected result should be that in the second snapshot, the ListView should not go below 10 pixel above theNext & Previous buttons (as marked by green line). It already has scroll bar. How to solve this problem? Kindly ask for more information if needed.
Here is the XAML:
<UserControl x:Class="A.B.C"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:A.B.SE.Manager"
mc:Ignorable="d"
DataContextChanged="UserControl_DataContextChanged" ><Grid><ListView Margin="10,195,10,10" Name="questionListView" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding Path=SEQuestions}" VerticalAlignment="Top"><ListView.ItemTemplate><DataTemplate><StackPanel><Expander Cursor="Hand"><Expander.Header><TextBlock TextWrapping="Wrap" FontSize="16" Foreground="#FF81B9F1"><Run Text="{Binding Path=title}"/></TextBlock></Expander.Header><StackPanel><TextBlock Text="{Binding Path=body_markdown}" Foreground="#FFB2AAAA" TextWrapping="Wrap"/><WrapPanel><Expander><Expander.Header><TextBlock><Run Text="{Binding Path=comment_count, StringFormat='\{0} comment'}"/></TextBlock></Expander.Header><ListView Name="commentListView" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding Path=comments}"><ListView.ItemTemplate><DataTemplate><StackPanel><TextBlock TextWrapping="Wrap" Text="{Binding Path=body_markdown}"/><Separator/></StackPanel></DataTemplate></ListView.ItemTemplate></ListView></Expander><Expander><Expander.Header><TextBlock><Run Text="{Binding Path=answer_count, StringFormat='\{0} answer'}"/></TextBlock></Expander.Header><ListView Name="answerListView" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding Path=answers}"><ListView.ItemTemplate><DataTemplate><StackPanel><TextBlock TextWrapping="Wrap" Text="{Binding Path=body_markdown}"/><Separator/><Expander><Expander.Header><TextBlock><Run Text="{Binding Path=comment_count, StringFormat='\{0} comments'}"/></TextBlock></Expander.Header><ListView Name="commentsOnAnswerListView" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding Path=comments}"><ListView.ItemTemplate><DataTemplate><StackPanel><TextBlock TextWrapping="Wrap" Text="{Binding Path=body_markdown}"/><Separator/></StackPanel></DataTemplate></ListView.ItemTemplate></ListView></Expander></StackPanel></DataTemplate></ListView.ItemTemplate></ListView></Expander></WrapPanel><TextBlock Text="{Binding Path=last_activity_date, StringFormat='Last activity at {0}'}"/></StackPanel></Expander><Separator/></StackPanel></DataTemplate></ListView.ItemTemplate></ListView><Button Content="Next" Margin="10,740,10,10" HorizontalAlignment="Left" VerticalAlignment="Top" Width="60" Click="nextButtonClick"/><Button Content="Previous" Margin="200,740,10,10" HorizontalAlignment="Right" VerticalAlignment="Top" Width="60" Click="previousButtonClick"/></Grid></UserControl>