private void OnEditResource(object sender, ExecutedRoutedEventArgs e) { TabbedColorEditorControl colorEditorControl = sender as TabbedColorEditorControl; if (colorEditorControl != null) { SceneNodeProperty editingProperty = colorEditorControl.editingProperty; if (!editingProperty.IsValueSystemResource) { if (this.resourcePopupOpen) { this.resourceEditorPopup.IsOpen = false; } else { this.resourceEditorPopup = new WorkaroundPopup(); this.resourceEditorPopup.Child = (UIElement) new ResourceEditorControl(editingProperty.SceneNodeObjectSet.DesignerContext, editingProperty); UIElement uiElement = e.Parameter as UIElement; if (uiElement != null) { Point point = uiElement.TransformToAncestor((Visual)colorEditorControl).Transform(new Point(0.0, 0.0)); this.resourceEditorPopup.PlacementTarget = (UIElement)colorEditorControl; this.resourceEditorPopup.Placement = PlacementMode.RelativePoint; this.resourceEditorPopup.HorizontalOffset = point.X; this.resourceEditorPopup.VerticalOffset = point.Y + uiElement.RenderSize.Height; this.resourceEditorPopup.Closed += new EventHandler(this.EditResourcePopupClosed); this.resourceEditorPopup.IsOpen = true; this.resourcePopupOpen = true; } } } } e.Handled = true; }
void IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.ColorTabControl = (TabbedColorEditorControl)target; break; case 2: this.TabbedView = (TabControl)target; this.TabbedView.SelectionChanged += new SelectionChangedEventHandler(this.OnColorTabChanged); break; case 3: this.ColorEditorTabItem = (TabItem)target; break; case 4: this.ColorMarker = (PropertyMarker)target; break; case 5: this.ColorEditor = (ColorEditor)target; break; case 6: this.ColorResourceTabItem = (TabItem)target; break; case 7: this.ResourceList = (OnDemandControl)target; break; default: this._contentLoaded = true; break; } }