我正在使用帶有 .Net Framework 4.8 專案的 AvalonEdit WPF 控制元件,在 Windows 10 64 位下使用 Visual Studio 2019。
我需要為行號添加右邊距。為了了解我需要什么,我附上了一張不言自明的圖片:

接下來是我的實際 xaml 代碼:
<avalonEdit:TextEditor
Grid.Column="2" Grid.Row="2"
xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit"
xmlns:editing="clr-namespace:ICSharpCode.AvalonEdit.Editing;assembly=ICSharpCode.AvalonEdit"
xmlns:rendering="clr-namespace:ICSharpCode.AvalonEdit.Rendering;assembly=ICSharpCode.AvalonEdit"
Name="TextEditor"
FontFamily="Consolas"
SyntaxHighlighting="C#"
ShowLineNumbers="True"
FontSize="10pt" Margin="0">
</avalonEdit:TextEditor>
希望有人可以幫我解決這個問題,我花了兩天時間嘗試添加此邊距,但無法獲得適當的解決方案。提前致謝。
uj5u.com熱心網友回復:
雖然我評論中的方法可行,但我想到了一種更簡單的方法。只需從源中復制 TextArea 的樣式并對其進行修改以在包含所有編輯器邊距的 ItemsControl 右側包含一些邊距。風格在這里:

轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/458844.html
