Your Class
public class Movie
{
public string Actor { get; set; }
public string Name { get; set; }
}
Create a List of Movie with the Data .
public class MovieList : List<Movie>
{
public MovieList()
{
Add(new Movie { Name = "Titanic", Actor = "xxx", });
Add(new Movie { Name = "LordOFtheRings", Actor = "yyyy", });
}
}
In XAML,
<ListBox Height="596" Name="listBox1" Width="380" >
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Name}"></TextBlock>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
In your code behind.cs
public MainPage()
{
InitializeComponent();
FillListBox();
}
private void FillListBox()
{
listBox1.ItemsSource = new MovieList();
}
Your Textbox should be
<TextBox Text="{Binding ElementName=listBox1, Path=SelectedValue}"/>