Beispiel #1
0
        /// <summary>
        /// Selects the highlight as the current highlight when iterating through hits, bringing the control to focus.
        /// </summary>
        public override void Select()
        {
            System.Windows.Controls.FlowDocumentScrollViewer fdpv = (BodyAdorner.AdornedElement as System.Windows.Controls.FlowDocumentScrollViewer);
            fdpv.Selection.Select(run.ContentStart.GetPositionAtOffset(Start), run.ContentStart.GetPositionAtOffset(End));
            ScrollViewer scr = Utility.FindScrollViewer(fdpv);

            scr.ScrollToVerticalOffset(fdpv.Selection.Start.GetCharacterRect(LogicalDirection.Forward).Top);
            fdpv.Focus();//focusing is very important because not only is it correct user behaviour but it also allows us to track the user moving focus to other controls better
            base.Select();
        }