**Combobox XAML**
Items in the ComboBox come from an array. Therefore it does not appear in XAML
<ComboBox Name="cbSelectMovie" HorizontalAlignment="Left" Margin="252,174,0,0" VerticalAlignment="Top" Width="196" Height="32" SelectionChanged="cbSelectMovie_SelectionChanged">
When the button is pressed, it is added to the ListBox.
<Button Content="Ad Movie..." HorizontalAlignment="Left" FontSize="14" Margin="56,264,0,0" VerticalAlignment="Top" Width="165" Height="46" Click="Button_Click" />
ListBox on another page
<ListBox x:Name="movieListBox" HorizontalAlignment="Left" Height="326" Margin="38,44,0,0" VerticalAlignment="Top" Width="231"/>
I did such a try, but unfortunately, it didn't work.
private void Button_Click(object sender, RoutedEventArgs e)
{
string x = " " ;
MovieList mv = new MovieList();
// mv.MovieListBox = cbSelectMovie.Text;
cbSelectMovie.SelectedItem = x.ToString();
mv.MovieListBox.Items.Add(x);
}
question from:
https://stackoverflow.com/questions/65647260/how-do-i-add-the-item-i-selected-in-the-combobox-to-the-list-box-on-another-page 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…