简体   繁体   English

如何将某些项设置为LongListMultiSelector之前选择的某些项

[英]How to set item some as selected, that was selected before of LongListMultiSelector

I am using wpToolkit's LongListMultiSelector. 我正在使用wpToolkit的LongListMultiSelector。

I want to select different songs from different albums. 我想从不同的专辑中选择不同的歌曲。

  1. First go to "Album 1" page select "song 1", "song 2". 首先进入“专辑1”页面,选择“歌曲1”,“歌曲2”。
  2. Came back to album List page. 回到专辑列表页面。
  3. Again go to same album "Album 1" page. 再次转到同一专辑的“专辑1”页面。

I want to show user that "song 1", "song 2" are selected before try to select one. 我想告诉用户选择“歌曲1”,“歌曲2”之前先进行选择。 But I am unable to mark the previous selected songs, if user came back to the same album. 但是,如果用户回到同一张专辑,则无法标记以前选择的歌曲。

Is there any way to do that. 有没有办法做到这一点。

Check the selected SongList with the album songs. 检查所选歌曲列表和专辑歌曲。 then add to the lls like that. 然后像这样添加到lls中。

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++;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM