Thumb does not get shown in custom control #18394
-
Describe the bugWhen creating a custom To ReproduceIn https://github.com/AvaloniaUI/AvaloniaUI.QuickGuides/blob/main/CustomControl/Controls/CustomUserControl.axaml, replace the <Canvas Background="Yellow" Width="200" Height="100">
<Thumb Width="10" Height="10"
Background="Blue"
BorderBrush="Red"
BorderThickness="3"
Canvas.Left="75"
Canvas.Top="50" />
</Canvas> Now, the Expected behaviorA Avalonia version11.2.4 OSWindows Additional contextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Thumb is a primitive that doesn't have its own template by default |
Beta Was this translation helpful? Give feedback.
-
@maxkatz6 okay, so then it's not a bug, but still, how would you put a thumb into a custom |
Beta Was this translation helpful? Give feedback.
-
You need to add a ControlTemplate preferred via Style or ControlTheme. Check out existing ones from source if you have no idea how to. I believe Scrollbar is using one. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the help guys, I figured it out now! |
Beta Was this translation helpful? Give feedback.
You need to add a ControlTemplate preferred via Style or ControlTheme. Check out existing ones from source if you have no idea how to. I believe Scrollbar is using one.
https://github.com/AvaloniaUI/Avalonia/blob/master/src%2FAvalonia.Themes.Fluent%2FControls%2FScrollBar.xaml#L21-L36