I have a file in which the first line is a phone and the second is a date.
I read the file and add the content to a listbox fine and everything is in a different row.
Now i changed the listbox to contain 2 textboxes.
<ListBox Name="listBox1" ItemsSource="{Binding}">
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Phone}" FontSize="32"/>
<TextBlock Text="{Binding MyDate}" FontSize="16"/>
</StackPanel>
</DataTemplate>
How to bind the data from the file?
Thank you
Create a class to represent your data:
Then load your data into a list
Finally bind the list to the listbox:
Now your bindings will work.