Beispiel #1
0
 protected override void OnRender(DrawingContext drawingContext)
 {
     base.OnRender(drawingContext);
     if (isVisible)
     {
         Brush caretBrush = this.CaretBrush;
         if (caretBrush == null)
         {
             caretBrush = (Brush)textView.GetValue(TextBlock.ForegroundProperty);
         }
         Rect r = new Rect(caretRectangle.X - textView.HorizontalOffset,
                           caretRectangle.Y - textView.VerticalOffset,
                           caretRectangle.Width,
                           caretRectangle.Height);
         drawingContext.DrawRectangle(caretBrush, null, PixelSnapHelpers.ToPixels(r));
     }
 }