WPF - ListView within listView Scrollbar problem

Posted by Josh on Stack Overflow See other posts from Stack Overflow or by Josh
Published on 2010-05-13T20:59:18Z Indexed on 2010/05/13 21:04 UTC
Read the original article Hit count: 1981

Filed under:
|
|
|

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"

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf