3
votes

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)

2
One time I have the similar issue with ExpanderView. It shows 2048px of content Height. Maybe it's something similar... - Ku6opr

2 Answers

6
votes

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>
0
votes

I had similar problem with the ExpanderView. I think it could be a bug in the view, somehow related to the 2048px limitation. Basically when I added lot of items to an expanded ExpanderView everything was fine untill I collapsed the view and expanded it again. After expanding the ExpanderView, any items after the 2048 pixel where not shown unless i tapped them or scrolled it and even then they were shown only for as long as they were on the move (the tap animation of the item was running or the list was on the move).

I noticed that if I added an item to the ExpanderView or removed one from it while it was expanded, the glitch went away until the next time I collapsed and expanded the item, so I made a quick work around to add and remove a dummy item to the view when ever it was expanded by using the Expanded- and LayoutUpdated- events of the ExpanderView. Basically this is what I did:

  • Set state to indicate that expanding is in progress and store the view being expanded for later use. (in Expanded event handler)
  • Wait untill all the Expanderviews' layouts are updated (use LayoutUpdated event handler to keep track on this)
  • Add dummy item to the ExpanderView that was expanded (in LayoutUpdated event handler)
  • Wait untill all the Expanderviews' layouts are updated
  • Remove the dummy item (in LayoutUpdated event handler)

Ugly solution perhaps but best I could come up with. Hope it's some help in your problem.

Edit: Doesn't help on that stopping line of the Expander thing. Just couldn't get that one to work..