2014-06-20 2 views
0

나는 이것을보고 있습니다 : http://code.msdn.microsoft.com/wpapps/Custom-LongList-Selector-bf8cb9ad 및 내 응용 프로그램에 통합하려고합니다. 그러나, 내 데이터가 다르게로드되기 때문에 조금 혼란스러워. 할 수 없습니다 : 바로 지금, 내가 CustomKeyGroup < .ViewModels.SoundData> .GetSoundGroups (System.Collections.Generic.List < .ViewModels.SoundData>)에 대한 두 가지 오류 최선의 오버로드 된 메서드 일치가 'Windows Phone의 사용자 지정 건너 뛰기 목록

인수 한 일부 잘못된 인수가 'string'에서 'System.Collections.Generic.List'로 변환

오류가 'CustomKeyGroup.GetSoundGroups (mvm.Items);'에 있습니다. mainpage.cs에서. 나는 그 물건이 문제라는 것을 알고있다. 링크를 보면, 그들은 listmovie.add와는 다른 방식으로 데이터를로드합니다.

큰 문제가 발생하지만 데이터가 다르기 때문에 제대로 작동하지 않으므로 잘 알고 있습니다.

ID는 내 SoundModel에있는 그룹 (Alpha, Bravo 등)별로 맞춤 jumplist가있는 것을 좋아합니다.

SoundData mvm = new SoundData(); 

      this.LongList.ItemsSource = CustomKeyGroup<SoundData>.GetSoundGroups(mvm.Items); 

SoundGroup :

{ 
    public class SoundGroup 
    { 
     public SoundGroup() 
     { 
      Items = new List<SoundData>(); 
     } 

     public List<SoundData> Items { get; set; } 
     public string Title { get; set; } 
     public string Groups { get; set; } 

    } 
} 

SoundData : 여기

namespace T.ViewModels 
{ 
    public class SoundModel: BindableBase 
    { 
     public SoundGroup NewAdds { get; set; } 
     public SoundGroup Software { get; set; } 

     } 

     public bool IsDataLoaded { get; set; } 



     public void LoadData() 
     { 
      // Load data into the model 
      Software = CreateSoftwareGroup(); 
      NewAdds = CreateNewAddsGroup(); 


      IsDataLoaded = true; 
     } 

     private SoundGroup CreateNewAddsGroup() 
     { 
      SoundGroup data = new SoundGroup(); 
      data.Title = "New"; 
      string basePath = "assets/audio/newadds/"; 

       data.Items.Add(new SoundData 
      { 
       Title = "Test1", 
       FilePath = basePath + "Test.mp3", 
       Groups = "Alpha" 
      }); 



      data.Items.Add(new SoundData 
      { 
       Title = "Test2", 
       FilePath = basePath + "Test2.mp3", 
       Groups="Bravo" 
      }); 


      data.Items.Add(new SoundData 
      { 
       Title = "Test3", 
       FilePath = basePath + "Test3.mp3", 
       Groups= "Zulu" 
      }); 

    private SoundGroup CreateSoftwareGroup() 
     { 
      SoundGroup data = new SoundGroup(); 

      data.Title = "Software"; 
      string basePath = "assets/audio/Software/"; 

      data.Items.Add(new SoundData 
      { 
       Title = "Test1", 
       FilePath = basePath + "Test.mp3", 
       Groups = "Alpha" 
      }); 

      data.Items.Add(new SoundData 
      { 
       Title = "Test2", 
       FilePath = basePath + "Test2.mp3", 
       Groups="Bravo" 
      }); 


      data.Items.Add(new SoundData 
      { 
       Title = "Test3", 
       FilePath = basePath + "Test3.mp3", 
       Groups= "Zulu" 
      }); 

관련 mainpage.cs됩니다 : 여기에 일부는 I에서 지금까지

{ 
    public class SoundData : ViewModelBase 
    { 
     public string Title { get; set; } 
     public string FilePath { get; set; } 
     public string Items { get; set; } 
     public string Groups { get; set; } 


     public RelayCommand<string> SaveSoundAsRingtone { get; set; } 


     private void ExecuteSaveSoundAsRingtone(string soundPath) 
     { 
      App.Current.RootVisual.Dispatcher.BeginInvoke(() => 
      { 
       SaveRingtoneTask task = new SaveRingtoneTask(); 
       task.Source = new Uri("appdata:/" + this.FilePath); 
       task.DisplayName = this.Title; 
       task.Show(); 
      } 
       ); 
     } 

     public SoundData() 
     { 
      SaveSoundAsRingtone = new RelayCommand<string>(ExecuteSaveSoundAsRingtone); 
     } 

    } 
} 

답변

0

무엇 이 함수를 호출해야한다는 것을 알 수 있습니다. 낮은

SoundModel svm = new SoundModel(); 
svm.LoadData(); 

this.LongList.ItemsSource = CustomKeyGroup<SoundData>.GetSoundGroups(svm.Software.Items); 

또는

this.LongList.ItemsSource = CustomKeyGroup<SoundData>.GetSoundGroups(svm.NewAdds.Items); 

이유는 당신이 방법 GetSoundGroups에서 Generic.List<.ViewModels.SoundData>을 통과해야하고 목록이 SoundGroup 클래스에 포함되어 있다는 것입니다. 로드 된 데이터가 SoundModel 클래스 내에 있으므로 위의 구현에 대해서만 생각할 수 있습니다.

+0

아직 충분한 담당자가 없기 때문에 죄송합니다. 죄송합니다. 아직 충분한 담당자가 없으므로 업 그레 이드가 불가능합니다. 오류가 없어졌고 지금은 그룹 머리글과 jumplist 템플릿을 조정해야합니다. 감사합니다 pushpraj! – user3556644

+0

큰 문제는 해결되었습니다. 투표를 할 수없는 경우에도이 답변을 수락 할 수 있습니다. 해피 코딩 :) – pushpraj