Search code examples
windows-phone-7silverlight-toolkitexpander

ExpanderView does not show all Items


I am using the ExpanderView of WindowsPhone Toolkit and on first load my expanded Expander will always look like the second picture. It seems, that its always at the same Height of all Items together.

If I goto another page and go back, everything will be fine and the Layout look quiet correct - except that stopping line of the Expander (Pic 1).

Either this.UpdatedLayout();(current Page) nor ExpanderView.UpdateLayout(); resolved anything. Items which doesn't show up are fully loaded in that list.

part 1

part 2

<ItemsControl ItemsSource="{Binding EpisodeList}" Margin="20,0,0,0" Grid.Row="1" Grid.ColumnSpan="2">
<ItemsControl.ItemTemplate>
    <DataTemplate>
        <StackPanel>
            <toolkit:ExpanderView ItemsSource="{Binding Value}" >
                <toolkit:ExpanderView.Header>
                    <TextBlock Margin="0,0,10,0">
            <Run Text="Season "/>
            <Run Text="{Binding Key}" />
                    </TextBlock>
                </toolkit:ExpanderView.Header>
                <toolkit:ExpanderView.ItemTemplate>
                    <DataTemplate>
                        <Border BorderBrush="White" BorderThickness="1" Margin="5">
                            <Grid MouseLeftButtonUp="Grid_MouseLeftButtonUp">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition />
                                </Grid.ColumnDefinitions>
                                <Image Height="40"  Source="{Binding ScreenCap}" Margin="5,0,0,0"/>
                                <TextBlock x:Name="t" Margin="10" Text="{Binding Title}" TextWrapping="Wrap" Grid.Column="1" />
                            </Grid>
                        </Border>
                    </DataTemplate>
                </toolkit:ExpanderView.ItemTemplate>

            </toolkit:ExpanderView>
        </StackPanel>
    </DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

EpisodeList is type of Dictionary(int,ObservableCollection(myClass)) and implements INotifyPropertyChanged

If anyone got any plan whats going wrong here, I really would appreciate your help, i just did not found any bugreport on that list on google nor a similar Bug.

(Debugged on Device as well as on Emulator)


Solution

  • I managed to solve this by using a listbox as the itemcontainer, and binding the expander items to it:

                        <Controls:ExpanderView Expanded="ExpanderView_Expanded"
                            Header="{Binding}"                               
                            HeaderTemplate="{StaticResource HeaderTemplate}"                                                                             
                            NonExpandableHeader="{Binding}" 
                            ExpanderTemplate="{StaticResource ExpanderTemplate}"
                            NonExpandableHeaderTemplate="{StaticResource NonExpandableHeaderTemplate}"
                            Expander="{Binding}"
                            >
                            <ListBox ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemTemplate="{StaticResource ItemTemplate}" ItemsSource="{Binding Items}" />
                        </Controls:ExpanderView>