2012-09-14 2 views

답변

0

문서화, 검색 및 질문을 통해 끝없는 시간을 읽은 것 같았습니다. 나는 이것을 스스로 알아낼 수 있었다.

XAML :

<ListBox Name="NotesList"> 
        <ListBox.ItemTemplate> 
         <DataTemplate> 
          <TextBlock Text="{Binding Filename}" /> 
         </DataTemplate> 
        </ListBox.ItemTemplate> 
       </ListBox> 

코드 숨김

public class NoteView 
    { 
     public string Filename { get; set; } 
     public string Contents { get; set; } 
    } 

    /// <summary> 
    /// Invoked when this page is about to be displayed in a Frame. 
    /// </summary> 
    /// <param name="e">Event data that describes how this page was reached. The Parameter 
    /// property is typically used to configure the page.</param> 
    protected override void OnNavigatedTo(NavigationEventArgs e) 
    { 
     var noteList = new ObservableCollection<NoteView>(); 

     for (int i = 0; i < 10; i++) 
     { 
      noteList.Add(new NoteView { Filename = "Sample note " + i }); 
     } 

     NotesList.ItemsSource = noteList; 
    } 
다음

내가 내 상황에 필요한대로 작동 코드