private void lstFrames_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListBoxItem item = (ListBoxItem)lstFrames.SelectedItem; currentFrameController = (GnosisFrameController)item.Tag; currentFrameController.SetEditMode(); //register for property changes, include child panels. Content of panels can change so //we must register for their child property changes on the panel loaded event currentFrameController.PropertyChanged += Controller_PropertyChanged; foreach (GnosisInnerLayoutController child in currentFrameController.ChildControllers) { child.PropertyChanged += Controller_PropertyChanged; } //List<GnosisFramePresentation> presentations = currentFrameController.FramePresentations; //pnlButtonFormats.Children.Clear(); //lstLabels = new List<Label>(); //foreach (GnosisFramePresentation framePresentation in presentations) //{ // Label lblPresentation = new Label(); // lblPresentation.Tag = framePresentation; // // btnPresentation.Click += BtnPresentation_Click; // lblPresentation.Content = framePresentation.Format.ToString(); // if (framePresentation.Format == currentFrameController.CurrentPresentation.Format) // { // //highlight current format // lblPresentation.Background = Brushes.Lime; // //update fields // UpdateFramePresentationFields(framePresentation); // } // lstLabels.Add(lblPresentation); // pnlButtonFormats.Children.Add(lblPresentation); //} mainTile.Clear(); mainTile.LoadFrameImplementation((IGnosisFrameImplementation)currentFrameController.ControlImplementation); }