views:

199

answers:

1

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"

A: 

** 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.

Jeff Wain
Using a ListBox instead of ListView doesn't seem to change anything, unless you meant something other then change the ListView tags to ListBox tags.
Josh
Do you have a default style set on your ListView or TabItem that might be overwriting some properties? Otherwise another thing I would try is to make sure that the VerticalAlignment property on each of your controls is set to Stretch and see if that helps.
Jeff Wain
So i tried using stretch to fix the problem, it didn't help. Do I possibly need to fire a property change to list A when I add and an episode to List B, because List A never know whens List B changes. Also List A will scroll properly if there is more then one item. The only time the scroll view doesn't work properly is when List B has more items then can be show in the view area and List A has only one item.
Josh