首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将某些项设置为已选定的项,该项是在LongListMultiSelector之前选定的

如何将某些项设置为已选定的项,该项是在LongListMultiSelector之前选定的
EN

Stack Overflow用户
提问于 2015-11-26 15:24:03
回答 1查看 40关注 0票数 0

我正在使用wpToolkit的LongListMultiSelector。

我想从不同的专辑中选择不同的歌曲。

  1. 首先转到“专辑1”页面,选择“歌曲1",”歌曲2“。
  2. 回到专辑列表页面。
  3. 再次转到相同的专辑“专辑1”页面。

我想向用户显示,“歌曲1”、“歌曲2”是在尝试选择一个之前被选中的。但是,如果用户返回同一张专辑,我无法标记之前选定的歌曲。

有没有办法这么做。

EN

回答 1

Stack Overflow用户

发布于 2016-01-17 09:04:09

使用专辑歌曲检查选定的SongList。然后添加到这样的lls中。

代码语言:javascript
复制
llms.ItemsSource = this.mediaCollection;

int i = 0;
foreach (StorageFile file in SongList) //SongList of the album
{
    var thumb = await GetThumbImage(file, ThumbnailMode.MusicView, 150);

    var songItem = new songModel() { StorageFile = file, ThumbImage = thumb };//songModel is a song class
    this.mediaCollection.Add(songItem); 

    if (MultiplePhoto.Instance.SongItems.Count > 0) //SongItems contains the selected songlist
       if (MultiplePhoto.Instance.SongItems.FirstOrDefault(x => x.StorageFile.Path == songItem.StorageFile.Path) != null) // check that is currently added song selected?
          llms.SelectedItems.Add(this.mediaCollection[i]); //here addd the selected item to the lls
    i++;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33942109

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档