public class EditorControl : Control { void EditorTextBoxControl_TextChanged(object sender, TextChangedEventArgs e) { if(_bIsNewScriptLoaded) RaiseEditorTextChangedEvent(); //need to call here } } public class LineMargin : FrameworkElement { protected override void OnRender(System.Windows.Media.DrawingContext drawingContext) { Rect rect = EditorText.GetRectFromCharacterIndex(charIndex); //this is the height of each line in textEditor. if (rect.IsEmpty == true) lineHeight = 0; else lineHeight = rect.Height; for (int i = 0; lineNumber <= _Controller.GetLineCount(); i++, lineNumber++) { //var foreground = (Brush)GetValue(Control.ForegroundProperty); FormattedText text = new FormattedText( lineNumber.ToString(CultureInfo.CurrentCulture), CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, new Typeface("Verdana"), emSize, Brushes.SteelBlue); drawingContext.DrawText(text, new Point(renderSize.Width - text.Width, (lineHeight * i) + 2));//2 is a buffer as the number should be displayed little below the rectangle height. } } }
OnRender
F
internal
public
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)