Exemplo n.º 1
0
        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);
                }

                SetContentTooltipWrapper(o, popup);
            }
        }
Exemplo n.º 2
0
        private void HideInternal()
        {
            Visibility = Visibility.Collapsed;

            IsOpen = false;

            lastShownPopup = null;
        }
Exemplo n.º 3
0
 static void ResetTimer(RichToolTip tooltip)
 {
     if (_timer != null)
     {
         _timer.Tick -= tooltip.ShowDeferred;
         _timer.Stop();
     }
 }
Exemplo n.º 4
0
        private static void OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RichToolTip ctrl = (RichToolTip)d;

            if ((bool)e.NewValue)
            {
                if (ctrl._parentPopup == null)
                {
                    ctrl.HookupParentPopup();
                }
            }
        }
Exemplo n.º 5
0
        private void ShowDeferred(object sender, System.EventArgs e)
        {
            ResetTimer(this);

            HideLastShown(false);

            ShowInternal();

            if (showAnimate && EnableAnimation)
            {
                Animate(true);
            }
            else
            {
                this.Opacity = 1;
            }

            lastShownPopup = this;
        }
Exemplo n.º 6
0
        static bool TryFindPopupParent(object source, out RichToolTip popup)
        {
            popup = null;
            UIElement element = source as UIElement;

            if (element != null)
            {
                popup = UIHelpers.FindVisualAncestorByType <RichToolTip>(element);

                if (popup == null)
                {
                    popup = UIHelpers.FindLogicalAncestorByType <RichToolTip>(element);
                }

                return(popup != null);
            }

            return(false);
        }
Exemplo n.º 7
0
            private void HideInternal()
            {
                Visibility = Visibility.Collapsed;

                IsOpen = false;

                lastShownPopup = null;
            }
Exemplo n.º 8
0
            private void ShowDeferred(object sender, System.EventArgs e)
            {
                ResetTimer(this);

                HideLastShown(false);

                ShowInternal();

                if (showAnimate && EnableAnimation)
                {
                    Animate(true);
                }
                else
                {
                    this.Opacity = 1;
                }

                lastShownPopup = this;
            }
Exemplo n.º 9
0
            static bool TryFindPopupParent(object source, out RichToolTip popup)
            {
                popup = null;
                UIElement element = source as UIElement;

                if (element != null)
                {
                    popup = UIHelpers.FindVisualAncestorByType<RichToolTip>(element);

                    if (popup == null)
                    {
                        popup = UIHelpers.FindLogicalAncestorByType<RichToolTip>(element);
                    }

                    return popup != null;
                }

                return false;
            }
Exemplo n.º 10
0
 static void ResetTimer(RichToolTip tooltip)
 {
     if (_timer != null)
     {
         _timer.Tick -= tooltip.ShowDeferred;
         _timer.Stop();
     }
 }
Exemplo n.º 11
0
 internal static void SetContentTooltipWrapper(DependencyObject obj, RichToolTip value)
 {
     obj.SetValue(ContentTooltipWrapperProperty, value);
 }
Exemplo n.º 12
0
            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);

                    }

                    SetContentTooltipWrapper(o, popup);
                }
            }
Exemplo n.º 13
0
 internal static void SetContentTooltipWrapper(DependencyObject obj, RichToolTip value)
 {
     obj.SetValue(ContentTooltipWrapperProperty, value);
 }