Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot style slider #3807

Closed
leoshusar opened this issue Apr 22, 2020 · 1 comment
Closed

Cannot style slider #3807

leoshusar opened this issue Apr 22, 2020 · 1 comment

Comments

@leoshusar
Copy link

Hi, I have a problem with styling slider. I tried multiple selectors and setters and nothing worked.

Here is my last try:

<Style Selector="Slider /template/ Border#TrackBackground">
    <Setter Property="BorderThickness" Value="2" />
    <Setter Property="BorderBrush" Value="White" />
</Style>

<Style Selector="Slider /template/ Track">
    <Setter Property="Height" Value="10" />
</Style>

<Style Selector="Slider /template/ Thumb Ellipse">
    <Setter Property="Width" Value="20" />
    <Setter Property="Height" Value="20" />
</Style>

and the only things that are working are BorderThickness and BorderBrush. Thumb is untouched and that track height doesn't work too.
Basically I want to style it like this. Is it anyhow possible?
Thank you!

@maxkatz6
Copy link
Member

Yes, it's possible, but you might need to re-create whole template just like you would do in WPF.
Currently Avalonia styles are not powerful enough to allow to override values defined in the template with local value priority.
https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Default/Slider.xaml#L27

Yes, this issue is old, and most likely not actual anymore. But I just found it, and was able to answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants