예제 #1
0
        private void SetScrollBar()
        {
            VScrollBar = ContentGrid.ChildAt <ScrollBar>(0, 0, 1, 0, 0, 2);
            HScrollBar = ContentGrid.ChildAt <ScrollBar>(0, 0, 1, 0, 0, 3);

            UpdateScrollBar();
        }
예제 #2
0
        private void AutoSelectParagraph()
        {
            if (ParaVisualizer == null)
            {
                ParaVisualizer = ContentGrid.ChildAt <ItemsStackPanel>(0, 0, 0, 0, 0, 0, 1);
                if (ParaVisualizer == null)
                {
                    return;
                }
            }

            Rect ScreenBounds = IsHorz ? new Rect(0, 0, ActualWidth * 0.8, ActualHeight) : new Rect(0, 0, ActualWidth, ActualHeight * 0.8);

            if (VisibleParagraph != null && VisibleContext?.DataContext?.Equals(SelectedParagraph) == true)
            {
                if (VisualTreeHelper.FindElementsInHostCoordinates(ScreenBounds, ParaVisualizer).Contains(VisibleParagraph))
                {
                    return;
                }
            }

            int l = ParaVisualizer.Children.Count();

            for (int i = 0; i < l; i++)
            {
                FrameworkElement Item = ( FrameworkElement )ParaVisualizer.Children[i];
                if (VisualTreeHelper.FindElementsInHostCoordinates(ScreenBounds, ParaVisualizer).Contains(Item))
                {
                    FrameworkElement _ContentPresenter = Item.ChildAt <FrameworkElement>(0, 0, 1);
                    if (_ContentPresenter?.DataContext is Paragraph P)
                    {
                        VisibleParagraph         = Item;
                        VisibleContext           = _ContentPresenter;
                        SelectedParagraph        = P;
                        ContentGrid.SelectedItem = P;
                        Reader.SelectAndAnchor(P);
                        break;
                    }
                }
            }
        }
예제 #3
0
 private void ContentGrid_Loaded(object sender, RoutedEventArgs e)
 {
     VScrollBar = ContentGrid.ChildAt <ScrollBar>(0, 0, 1, 0, 0, 2);
     HScrollBar = ContentGrid.ChildAt <ScrollBar>(0, 0, 1, 0, 0, 3);
     UpdateScrollBar();
 }