2

I have a problem with my LongListSelector: The Jumplist ist not working properly. When a MenuItem is clicked, the JumpList opens correctly. But when afterwards a header is tapped, the LongListSelector does not jump to the correct position. Instead, the App freezes for about three seconds, and then the jumplist just closes.

Apparently, the program does not know where to jump, but how is this possible? I've used the List from here: http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj244365(v=vs.105).aspx

I'm creating the LongListSelector dynamically, might that be a Problem?

My List Class is:

public class Group<TKey, TItem> : ObservableCollection<TItem>
{
    public TKey Key { protected set; get; }

    public Group(TKey key, IEnumerable<TItem> items)
        : base(items)
    {
        Key = key;
    }

    public Group(IGrouping<TKey, TItem> grouping)
        : base(grouping)
    {
        Key = grouping.Key;
    }
}

I'm Binding with:

   LongListSelector listBox = new LongListSelector { JumpListStyle = (Style)Resources["MenuTemplate"], ItemTemplate = (DataTemplate)Resources["Template"], GroupHeaderTemplate = (DataTemplate)Resources["HeaderTemplate"], HideEmptyGroups = true, IsGroupingEnabled = true, LayoutMode = LongListSelectorLayoutMode.List, Name = "somename" };

XAML Templates: Header and Menu Template:

   <DataTemplate x:Key="HeaderTemplate">
        <Border Background="Transparent" Padding="5">
            <Border>
                <TextBlock Text="{Binding Key}"/>
            </Border>
        </Border>
    </DataTemplate>

    <Style x:Key="MenuTemplate" TargetType="phone:LongListSelector">
        <Setter Property="LayoutMode" Value="List" />
        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Border>
                        <TextBlock Text="{Binding Key}"/>
                    </Border>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>
Florian Moser
  • 2,147
  • 1
  • 24
  • 30

0 Answers0