ExpanderView doesn't show all items

I am using WindowsPhone Toolkit ExpanderView, and on first load my expanded Expander will always look like the second snapshot. It seems that it is always at the same height of all objects together.

If I navigate to another page and come back, everything is fine and the layout looks calm - except that the Expander stop line (Figure 1).

Or this.UpdatedLayout (); (current page), or ExpanderView.UpdateLayout (); resolved anything. Items that are not displayed are fully loaded into this 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 a dictionary type (int, ObservableCollection (myClass)) and implements INotifyPropertyChanged

If anyone has any plan for what is wrong here, I would really appreciate your help, I just couldn't find any error messages on this list on google and similar Bug.

(debuggable on both device and emulator)

+3


source to share


2 answers


I managed to solve this by using a listbox as an item container and binding 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>

      

+6


source


I had a similar problem with ExpanderView. I think it might be a bug in the view, somehow related to the 2048px limit. Basically when I added a lot of items to the expanded ExpanderView everything was fine until I collapsed the view and expanded it again. After expanding ExpanderView, all items after pixel 2048 if not shown unless I tapped or scrolled with them, and even then they were only shown as long as they were in motion (the element's tap animation was triggered or the list was on go).

I noticed that if I added an item to or removed from the ExpanderView while it was expanding, the glitch went away until the next time I collapsed and expanded the item, so I quickly worked around to add and remove a dummy item for the view when it has been extended with ExpanderView extended and LayoutUpdated events. This is basically what I did:

  • Set a state to indicate that an extension is in progress and save the expanded view for later use. (in extended event handler)
  • Wait until all Expanderviews have been updated (use the LayoutUpdated event handler to keep track of this)
  • Add dummy item to ExpanderView that has been expanded (in LayoutUpdated event handler)
  • Wait until all Expanderviews layouts are updated.
  • Remove dummy item (in LayoutUpdated handler handler)


An ugly solution, possibly the best I could think of. Hope it helps with your problem.

Edit: Doesn't help at this Expander line stop. Just couldn't get it to work.

0


source







All Articles