I create a new Xaml Windows application named Slide with some elements. I want to see list of this Slides instances in listbox element.
List slides = new List(); public void BtnNewSlide_OnClick(object sender, RoutedEventArgs e) { slides.Add(new Slide()); SlidesList.Items.Clear(); SlidesList.ItemsSource = slides.ToList(); }
but I get this error when click on BtnNewSlide
:
Window must be the root of the tree. Cannot add Window as a child of Visual.