private void Children_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { ShownArrivalsBinding.ClearCollections(); SubItemsControl.Children.Clear(); foreach (var item in VM.Children) { StopPopupControl subControl = new StopPopupControl(); subControl.Stop = item; subControl.IsTopLevel = false; subControl.VerticalAlignment = VerticalAlignment.Stretch; subControl.MinWidth = 190; subControl.SetBinding(ShowRoutesListProperty, new Binding() { Source = this, Path = new PropertyPath("ShowRoutesList") }); subControl.SetBinding(TitleCommandProperty, new Binding() { Source = this, Path = new PropertyPath("TitleCommand") }); subControl.SetBinding(ShowCompactMenuProperty, new Binding() { Source = this, Path = new PropertyPath("ShowCompactMenu") }); ShownArrivalsBinding.AddCollection(item.ID, subControl.ShownArrivals); subControl.SetBinding(StopPopupControlBase.NavigateToLocationCommandProperty, new Binding() { Source = this, Path = new PropertyPath("NavigateToLocationCommand") }); SubItemsControl.Children.Add(subControl); } if (VM.Children.Count == 0) { ShownArrivalsBinding.AddCollection("0", ArrivalsBox.ShownArrivals); } }
private void Children_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { ShownArrivalsBinding.ClearCollections(); SubItemsControl.Children.Clear(); foreach (var item in VM.Children) { StopPopupControl subControl = new StopPopupControl(); subControl.Stop = item; subControl.IsTopLevel = false; subControl.VerticalAlignment = VerticalAlignment.Stretch; subControl.MinWidth = 190; subControl.SetBinding(ShowRoutesListProperty, new Binding() { Source = this, Path = new PropertyPath("ShowRoutesList") }); subControl.SetBinding(TitleCommandProperty, new Binding() { Source = this, Path = new PropertyPath("TitleCommand") }); subControl.SetBinding(ShowCompactMenuProperty, new Binding() { Source = this, Path = new PropertyPath("ShowCompactMenu") }); ShownArrivalsBinding.AddCollection(item.ID, subControl.ShownArrivals); SubItemsControl.Children.Add(subControl); } if (VM.Children.Count == 0) { ShownArrivalsBinding.AddCollection("0", ArrivalsBox.ShownArrivals); } }