첫 번째 줄이 전화이고 두 번째 줄이 날짜 인 파일이 있습니다. 파일을 읽고 목록 상자에 내용을 추가하면 모든 내용이 다른 행에 있습니다. 이제 2 개의 텍스트 상자를 포함하도록 목록 상자를 변경했습니다. 텍스트 파일을 읽고 목록 상자에 추가 WP7
<ListBox Name="listBox1" ItemsSource="{Binding}">
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Phone}" FontSize="32"/>
<TextBlock Text="{Binding MyDate}" FontSize="16"/>
</StackPanel>
</DataTemplate>
어떻게 파일에서 데이터를 바인딩하는? 감사합니다.
이 제가 사용하여 파일 읽기 방법된다 (리더는 StreamReader = 새에서는 StreamReader (FILESTREAM)) { 할 { mPhone reader.ReadLine =(); MyDate = reader.ReadLine(); this.listBox1.Items.Add (mPhone); this.listBox1.Items.Add (MyDate); } while (! reader.EndOfStream); –
목록을 사용하는 방법을 데이터 = //로드 내가 그렇게 관리 –
하지만 목록 '코드'를 사용 (위해 StreamReader 리더 = 새에서는 StreamReader (FILESTREAM)) 비어 { 할 { mPhone = reader.ReadLine(); MyDate = reader.ReadLine(); list.Add (new PhoneDate (mPhone, MyDate)); } while (! reader.EndOfStream); listBox1.ItemsSource = list; } –