0
votes

I am having a Long List Multi Selector with Grouping enabled to have jump list feeling for Windows Phone 8 app.

We can select maximum of 8 items in long list multi selector. After selecting the items the items can be seen checked and in code as well I am able to retrieve them via SelectedItems list.

But when I am trying to come back to that page again with same item source to Long List MultiSelector and trying to get Selected Items list pre-selected when Long List Multi Selector is opened the functionality is not happening.

PFB the sample code for the same:-

foreach (var item in SelectedValue)   
   MultiSelectLongList.SelectedItems.Add(item);

everything else is working correctly in Long List multi selector except for preselecting some items when list is opened.

Is there any other way of doing it. Please help me out.

Thanks

1

1 Answers

0
votes

If you are using the Phone toolkit LongListMultiSelector control, this should actually just work.

But you are not showing a lot of code, so we can't see how you are keeping track of the objects and what objects are really set to the ItemsSource of the list.

As you can see in my screenshot, when I just load a LongList with some data and add that same data ( note the word same here because it needs to be the same reference ), the are preselected in the emulator.

If you don't have the correct reference you can itterate the itemssource with linq and get them through some key if needed.

2 ways I pre selected items

this.LongListSelector.SelectedItems.Add(data1);
this.LongListSelector.SelectedItems.Add(this.LongListSelector.ItemsSource[2]);

enter image description here