So I currently have a ListView "List A" who's items each have an expander control which contains another ListView "List B". The problem I am having is that sometimes List B grows so big that it extends beyond the range of List A's view area. List A's scroll bars do not pick up the fact that parts of List B are not being displayed. Is there a way to setup my xaml so that the scroll bars for List A will detect when the list inside the expander is longer then the viewing area of List A.
Here is the section of code I need to modify:
<TabItem Header="Finished">
<TabItem.Resources>
<ResourceDictionary>
<DataTemplate x:Key="EpisodeItem">
<DockPanel Margin="30,3">
<TextBlock Text="{Binding Title}" 开发者_如何学运维DockPanel.Dock="Left" />
<WrapPanel Margin="10,0" DockPanel.Dock="Right">
<TextBlock Text="Finished at: " />
<TextBlock Text="{Binding TimeAdded}" />
</WrapPanel>
</DockPanel>
</DataTemplate>
<DataTemplate x:Key="AnimeItem">
<DockPanel Margin="5,10">
<Image Height="75" Width="Auto" Source="{Binding ImagePath}" DockPanel.Dock="Left" VerticalAlignment="Top"/>
<Expander Template="{StaticResource AnimeExpanderControlTemplate}" >
<Expander.Header>
<TextBlock FontWeight="Bold" Text="{Binding AnimeTitle}" />
</Expander.Header>
<ListView ItemsSource="{Binding Episodes}" ItemTemplate="{StaticResource EpisodeItem}" BorderThickness="0,0,0,0" />
</Expander>
</DockPanel>
</DataTemplate>
</ResourceDictionary>
</TabItem.Resources>
<ListView Name="finishedView" ItemsSource="{Binding UploadedAnime, diagnostics:PresentationTraceSources.TraceLevel=High}" ItemTemplate="{StaticResource AnimeItem}" />
</TabItem>
List A is the ListView with name "finishedView" and List B is the ListView with ItemSource "Episodes"
** Edit - Scratch my earlier answer, since you're dealing with a list of single items you'd better of using a ListBox
and letting it handle the content on its own.
精彩评论