private void UserControlRendered()
        {
            //Remove if editor already exists
            List <UIElement> itemstoremove = new List <UIElement>();

            foreach (UIElement children in NavigatorGrid.Children)
            {
                if (children is CodeNavigator)
                {
                    itemstoremove.Add(children);
                }
            }
            foreach (UIElement children in itemstoremove)
            {
                NavigatorGrid.Children.Remove(children);
            }
            //Obtain and add navigator
            CodeNavigator navigator = Editor.GetNavigator();

            DockPanel.SetDock(navigator, Dock.Right);
            NavigatorGrid.Children.Add(navigator);
            //Setup the Code Viewer
            Viewer.SetupViewer(Editor.Text);
            Viewer.LinkedEditor = Editor;
            //Setup the find and replace dialogs
            FindPanel.LinkedEditor    = Editor;
            ReplacePanel.LinkedEditor = Editor;
        }
 protected override void OnRender(DrawingContext drawingContext)
 {
     DrawBlocks();
     base.OnRender(drawingContext);
     //Render the navigator once the editor is ready
     if (navigator == null && scrollViewer.ViewportHeight != 0)
     {
         navigator = new CodeNavigator(GetFormattedText(Text),
                                       new Point(2 - HorizontalOffset, VerticalOffset));
         navigator.LinkedScrollViewerHeight = scrollViewer.ViewportHeight;
         navigator.ScrollMethod             = new CodeNavigator.ScrollDelegate(Scroll);
         RenderMethod();
     }
 }
Beispiel #3
0
 protected override void OnRender(DrawingContext drawingContext)
 {
     DrawBlocks();
     base.OnRender(drawingContext);
     //Render the navigator once the editor is ready
     if (navigator != null || scrollViewer == null || scrollViewer.ViewportHeight == 0)
     {
         return;
     }
     navigator = new CodeNavigator(GetFormattedText(Text),
                                   new Point(2 - HorizontalOffset, VerticalOffset))
     {
         LinkedScrollViewerHeight = scrollViewer.ViewportHeight,
         ScrollMethod             = Scroll
     };
     RenderMethod();
 }