private static void OnPopupContentChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { UIElement element = o as UIElement; if (element == null) { throw new InvalidOperationException("Can't hook to events other than UI Element"); } if (e.NewValue != null) { RichToolTip popup = e.NewValue as RichToolTip; if (popup != null) { popup.Load(element); } else { popup = new RichToolTip(element); Binding binding = new Binding { Path = new PropertyPath(PopupContentProperty), Mode = BindingMode.OneWay, Source = o, }; popup.SetBinding(ContentProperty, binding); } //popup.SetBinding(DataContextProperty, new Binding { Source = element, Path = new PropertyPath(DataContextProperty) }); SetContentTooltipWrapper(o, popup); } }
private void HideInternal() { Visibility = Visibility.Collapsed; IsOpen = false; lastShownPopup = null; }
static void ResetTimer(RichToolTip tooltip) { if (_timer != null) { _timer.Tick -= tooltip.ShowDeferred; _timer.Stop(); } }
private static void OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { RichToolTip ctrl = (RichToolTip)d; if ((bool)e.NewValue) { if (ctrl._parentPopup == null) { ctrl.HookupParentPopup(); } } }
private void ShowDeferred(object sender, EventArgs e) { ResetTimer(this); HideLastShown(false); ShowInternal(); if (showAnimate && EnableAnimation) { Animate(true); } else { this.Opacity = 1; } lastShownPopup = this; }
static bool TryFindPopupParent(object source, out RichToolTip popup) { popup = null; UIElement element = source as UIElement; if (element != null) { popup = element.FindVisualAncestorByType <RichToolTip>(); if (popup == null) { popup = element.FindLogicalAncestorByType <RichToolTip>(); } return(popup != null); } return(false); }
internal static void SetContentTooltipWrapper(DependencyObject obj, RichToolTip value) { obj.SetValue(ContentTooltipWrapperProperty, value); }
private void HideInternal() { Visibility = Visibility.Collapsed; IsOpen = false; lastShownPopup = null; }
private void ShowDeferred(object sender, EventArgs e) { ResetTimer(this); HideLastShown(false); ShowInternal(); if (showAnimate && EnableAnimation) { Animate(true); } else { this.Opacity = 1; } lastShownPopup = this; }
static bool TryFindPopupParent(object source, out RichToolTip popup) { popup = null; UIElement element = source as UIElement; if (element != null) { popup = element.FindVisualAncestorByType<RichToolTip>(); if (popup == null) { popup = element.FindLogicalAncestorByType<RichToolTip>(); } return popup != null; } return false; }
static void ResetTimer(RichToolTip tooltip) { if (_timer != null) { _timer.Tick -= tooltip.ShowDeferred; _timer.Stop(); } }
internal static void SetContentTooltipWrapper(DependencyObject obj, RichToolTip value) { obj.SetValue(ContentTooltipWrapperProperty, value); }
private static void OnPopupContentChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { UIElement element = o as UIElement; if (element == null) { throw new InvalidOperationException("Can't hook to events other than UI Element"); } if (e.NewValue != null) { RichToolTip popup = e.NewValue as RichToolTip; if (popup != null) { popup.Load(element); } else { popup = new RichToolTip(element); Binding binding = new Binding { Path = new PropertyPath(PopupContentProperty), Mode = BindingMode.OneWay, Source = o, }; popup.SetBinding(ContentProperty, binding); } //popup.SetBinding(DataContextProperty, new Binding { Source = element, Path = new PropertyPath(DataContextProperty) }); SetContentTooltipWrapper(o, popup); } }