/// <summary> /// Be sure to call the base class constructor. /// </summary> /// <param name="adornedElement">The ui element to adorn</param> /// <param name="toolTip">The tooltip to show on click</param> /// <param name="overlayTemplate">A style for a PopupButton</param> public OverlayAdorner(UIElement adornedElement, ToolTip toolTip, ControlTemplate overlayTemplate) : base(adornedElement) { Debug.Assert(adornedElement != null, "adornedElement should not be null"); _popupButton = new PopupButton { IsTabStop = false, AdornedElement = adornedElement }; if (overlayTemplate != null) { _popupButton.Template = overlayTemplate; } if (toolTip != null) { _popupButton.ToolTip = toolTip; } AddVisualChild(_popupButton); }
/// <summary> /// Initializes a new instance of the <see cref="OverlayAdorner"/> class. /// Be sure to call the base class constructor. /// </summary> /// <param name="adornedElement">The ui element to adorn</param> /// <param name="toolTip">The tooltip to show on click</param> /// <param name="overlayTemplate">A style for a PopupButton</param> public OverlayAdorner(UIElement adornedElement, ToolTip toolTip, ControlTemplate overlayTemplate) : base(adornedElement) { Debug.Assert(adornedElement != null, "adornedElement should not be null"); this.popupButton = new PopupButton { IsTabStop = false, AdornedElement = adornedElement }; if (overlayTemplate != null) { this.popupButton.SetCurrentValue(Control.TemplateProperty, overlayTemplate); } if (toolTip != null) { this.popupButton.SetCurrentValue(ToolTipProperty, toolTip); } this.AddVisualChild(this.popupButton); }
/// <summary> /// The clear the single child of a TemplatedAdorner /// </summary> public void ClearChild() { this.RemoveVisualChild(this.popupButton); this.popupButton = null; }
/// <summary> /// The clear the single child of a TemplatedAdorner /// </summary> public void ClearChild() { RemoveVisualChild(_popupButton); _popupButton = null; }