Customizing the scroll bar of the TextEditor control #416
-
Hello, I am trying to customize the scroll bar of the TextEditor control in my Avalonia application. I know how to style scroll bars in general, but I am having difficulty applying these styles to the TextEditor's scroll bar. Does anyone know how I can customize the scroll bar of the TextEditor please? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Here is an example: I added a style to AvaloniaEdit.Demo to make the vertical scrollbar background red: <Window xmlns="https://github.com/avaloniaui"
xmlns:AvalonEdit="using:AvaloniaEdit"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="AvaloniaEdit.Demo.MainWindow" ...>
<Window.Styles>
<Style Selector="AvalonEdit|TextEditor.red /template/ ScrollViewer /template/ ScrollBar#PART_VerticalScrollBar">
<Setter Property="Background" Value="Red"/>
</Style>
</Window.Styles>
...
<AvalonEdit:TextEditor Classes="red"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Visible" />
...
</Window> |
Beta Was this translation helpful? Give feedback.
-
Thank you very much |
Beta Was this translation helpful? Give feedback.
-
Sorry to bother you again, but do you know how I can make the content of the text have a right margin? Because the scrollbar is currently overlapping my scroll bar. |
Beta Was this translation helpful? Give feedback.
-
Try: <AvalonEdit:TextEditor Padding="0,0,50,0" ... /> |
Beta Was this translation helpful? Give feedback.
Here is an example: I added a style to AvaloniaEdit.Demo to make the vertical scrollbar background red: