i'm a newbie in wpf and i'm trying to create two expanders that contains listview on each expander, in the header i created a searchtext box and works ok. The problem is that i cant create scrollview to the two expanders and fit the stackpanel height to the parent control. How can i create scrollview to the list views without the textbox?
Code:
<StackPanel Orientation="Vertical">
<TextBox Margin="3,3,3,3" FontSize="16" Height="25" Name="searchTextBox" TextChanged="SearchTextBox_OnTextChanged" Grid.Row="0"></TextBox>
<Border CornerRadius="6" BorderBrush="Gray" BorderThickness="1" DockPanel.Dock="Top" Grid.Row="1">
<StackPanel Orientation="Vertical">
<Expander IsExpanded="True" Background="LightGray" Grid.Row="0" >
<Expander.Header>
<TextBlock Text="A" FontWeight="Bold" Foreground="Gray" FontSize="22" VerticalAlignment="Bottom" />
</Expander.Header>
<Expander.Content>
<ListView Name="RecentEngines" BorderThickness="0" >
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" FontWeight="Bold" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Expander.Content>
</Expander>
<Expander IsExpanded="True" Background="LightGray" Grid.Row="1">
<Expander.Header>
<TextBlock Text="B" FontWeight="Bold" Foreground="Gray" FontSize="22" VerticalAlignment="Bottom" />
</Expander.Header>
<Expander.Content>
<ListView Name="Engines" BorderThickness="0" MaxHeight="300">
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" FontWeight="Bold" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Expander.Content>
</Expander>
</StackPanel>
</Border>
</StackPanel>