protected override Popup CreatePopup(object rootModel, IDictionary <string, object> settings) { var popup = new NonTopmostPopup(); // This makes double takes happen (TM) //popup.SetValue(PopupMenuCloseBehavior.IsEnabledProperty, true); if (ApplySettings(popup, settings)) { if (!settings.ContainsKey("PlacementTarget") && !settings.ContainsKey("Placement")) { popup.Placement = PlacementMode.MousePoint; } if (!settings.ContainsKey("AllowsTransparency")) { popup.AllowsTransparency = true; } } else { popup.AllowsTransparency = true; popup.Placement = PlacementMode.MousePoint; } return(popup); }
protected virtual void AttachToolTip(FrameworkElement element, DataTemplate toolTipContentTemplate) { // create empty tooltip to override any of underlaying tooltips element.ToolTip = new ToolTip(); element.ToolTipOpening += (s, e) => e.Handled = true; // content for the popup var contentControl = new ContentControl { BorderThickness = new Thickness(0, 0, 0, 0), Background = new SolidColorBrush(Colors.Transparent), ContentTemplate = toolTipContentTemplate }; // popup to show on the specified element var popup = new NonTopmostPopup { Child = contentControl, AllowsTransparency = true }; HudPopupService.SetInitialShowDelay(element, HudDefaultSettings.PopupShowDelay); HudPopupService.SetCloseDelay(element, HudDefaultSettings.PopupCloseDelay); HudPopupService.SetPlacement(element, PlacementMode.Top); HudPopupService.SetVerticalOffset(element, HudDefaultSettings.PopupVerticalOffset); HudPopupService.SetPopup(element, popup); }