Example #1
0
        public static Window ShowSubHint(Hint hint, FrameworkElement el, string hintText, Window owner)
        {
            var ht = HintRoot.Create(el);

            if (owner != null)
            {
                foreach (HintWindow window in owner.OwnedWindows)
                {
                    if (!window._hintRoot.Equals(ht))
                    {
                        window.Close();
                        continue;
                    }

                    ht.Dispose();
                    return(null);
                }
            }

            var wnd = new HintWindow(hint, ht)
            {
                Text = hintText, Owner = owner
            };

            if (hint.BackgroundResourceReference != null)
            {
                wnd.border.SetResourceReference(Border.BackgroundProperty, hint.BackgroundResourceReference);
            }

            if (hint.ForegroundResourceReference != null)
            {
                wnd._textBlock.SetResourceReference(TextBlock.ForegroundProperty, hint.ForegroundResourceReference);
            }

            wnd.Show();

            return(wnd);
        }
Example #2
0
        public HintWindow(Hint hint, HintRoot root)
        {
            InitializeComponent();

            this._hint    = hint;
            _hintRoot     = root;

            // window props
            Left          = 0;
            Top           = 0;
            MaxHeight     = 1200;
            SizeToContent = SizeToContent.WidthAndHeight;
            Opacity       = 1;

            _timer.Tick          += OnTimerTick;
            LayoutUpdated        += OnLayoutUpdated;
            MouseLeave           += OnMouseLeave;
            _hintRoot.MouseLeave += RestartCloseTimer;
            MouseRightButtonUp   += MouseButtonEventHandler;

            HintControl.AddClickHandler(this, OnClick);
            HintControl.AddMouseHoverHandler(this, OnMouseHover);
        }
Example #3
0
        public HintWindow(Hint hint, HintRoot root)
        {
            InitializeComponent();

            this._hint = hint;
            _hintRoot  = root;

            // window props
            Left          = 0;
            Top           = 0;
            MaxHeight     = 1200;
            SizeToContent = SizeToContent.WidthAndHeight;
            Opacity       = 1;

            _timer.Tick          += OnTimerTick;
            LayoutUpdated        += OnLayoutUpdated;
            MouseLeave           += OnMouseLeave;
            _hintRoot.MouseLeave += RestartCloseTimer;
            MouseRightButtonUp   += MouseButtonEventHandler;

            HintControl.AddClickHandler(this, OnClick);
            HintControl.AddMouseHoverHandler(this, OnMouseHover);
            TextOptions.SetTextFormattingMode((DependencyObject)this, TextFormattingMode.Display);
        }