Пример #1
0
        /// <summary>
        /// Tries to being the control into view.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="rect">The area of the control to being into view.</param>
        public static void BringIntoView(this IControl control, Rect rect)
        {
            var ev = new RequestBringIntoViewEventArgs
            {
                RoutedEvent  = Control.RequestBringIntoViewEvent,
                TargetObject = control,
                TargetRect   = rect,
            };

            control.RaiseEvent(ev);
        }
Пример #2
0
        /// <summary>
        /// Tries to bring the control into view.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="rect">The area of the control to being into view.</param>
        public static void BringIntoView(this IControl control, Rect rect)
        {
            Contract.Requires <ArgumentNullException>(control != null);

            var ev = new RequestBringIntoViewEventArgs
            {
                RoutedEvent  = Control.RequestBringIntoViewEvent,
                TargetObject = control,
                TargetRect   = rect,
            };

            control.RaiseEvent(ev);
        }
Пример #3
0
        protected virtual void OnRequestBringIntoView(RequestBringIntoViewEventArgs e)
        {
            if (e.TargetObject == this && _header != null)
            {
                var m = _header.TransformToVisual(this);

                if (m.HasValue)
                {
                    var bounds = new Rect(_header.Bounds.Size);
                    var rect   = bounds.TransformToAABB(m.Value);
                    e.TargetRect = rect;
                }
            }
        }
        /// <summary>
        /// Tries to bring the control into view.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="rect">The area of the control to being into view.</param>
        public static void BringIntoView(this IControl control, Rect rect)
        {
            _ = control ?? throw new ArgumentNullException(nameof(control));

            if (control.IsEffectivelyVisible)
            {
                var ev = new RequestBringIntoViewEventArgs
                {
                    RoutedEvent  = Control.RequestBringIntoViewEvent,
                    TargetObject = control,
                    TargetRect   = rect,
                };

                control.RaiseEvent(ev);
            }
        }