Ejemplo n.º 1
0
        public void ShowErrorTooltip(FrameworkElement attachTo, UIElement errorElement)
        {
            if (attachTo == null)
            {
                throw new ArgumentNullException("attachTo");
            }
            if (errorElement == null)
            {
                throw new ArgumentNullException("errorElement");
            }

            AttachedErrorBalloon b = new AttachedErrorBalloon(attachTo, errorElement);
            Point pos = attachTo.PointToScreen(new Point(0, attachTo.ActualHeight));

            b.Left      = pos.X;
            b.Top       = pos.Y - 8;
            b.Focusable = false;
            ITopLevelWindowService windowService = services.GetService <ITopLevelWindowService>();
            ITopLevelWindow        ownerWindow   = (windowService != null) ? windowService.GetTopLevelWindow(attachTo) : null;

            if (ownerWindow != null)
            {
                ownerWindow.SetOwner(b);
            }
            b.Show();

            if (ownerWindow != null)
            {
                ownerWindow.Activate();
            }

            b.AttachEvents();
        }