C
C#this hour
WantToBeeMe

How do i restyle the scrollbar, avalonia ui

I tried so many things. But i just cant seem to change 1 little thing of the style. For example i just tried to edit the thum to be rounded. And it just does nothing. I even tried putting a lot of parents below like so
<Style Selector="ListBox /template/ ScrollViewer /template/ ScrollBar#PART_VerticalScrollBar /template/ Track Thumb Border">
<Setter Property="CornerRadius" Value="8" />
</Style>
<Style Selector="ListBox /template/ ScrollViewer /template/ ScrollBar#PART_VerticalScrollBar /template/ Track Thumb Border">
<Setter Property="CornerRadius" Value="8" />
</Style>
But nope Littaraly everything i tried resulted in nothing. And i know i didnt just forget to merge it with the rest of the styles. In fact, i wrote it in the exact same style sheet as some of the style that did work just so i woudnt have that problem Anyways, i pressed F12 and look at the tree, thats where i derived these values from., Editing the values there works just fine. I searched the internet but avalonia content is pretty slim. I just need this radius to work, if thats the case then i can figure out the rest
No description
1 Reply
WantToBeeMe
WantToBeeMeOPthis hour
okay it gets even weirder If you look at this hierarchy, then you see that ScrollBar > Grid > Border
<!-- Works perfectly fine -->
<Style Selector="ScrollBar">
<Setter Property="Background" Value="red" />
</Style>

<!-- Works perfectly fine -->
<Style Selector="ScrollBar /template/ Grid#Root">
<Setter Property="Background" Value="red" />
</Style>

<!-- For some reason does not work anymore O_O -->
<<Style Selector="ScrollBar /template/ Border#VerticalRoot">
<Setter Property="Background" Value="red" />
</Style>
<!-- Works perfectly fine -->
<Style Selector="ScrollBar">
<Setter Property="Background" Value="red" />
</Style>

<!-- Works perfectly fine -->
<Style Selector="ScrollBar /template/ Grid#Root">
<Setter Property="Background" Value="red" />
</Style>

<!-- For some reason does not work anymore O_O -->
<<Style Selector="ScrollBar /template/ Border#VerticalRoot">
<Setter Property="Background" Value="red" />
</Style>
what is going on here?

Did you find this page helpful?