我想要设置 Avalonia Slider Control 的尺寸和颜色样式。
从视觉上看,它似乎可以工作,但它会停止滑动功能,我尝试查看Slider 源代码以找出如何正确执行此操作,但无法弄清楚。这是我正在使用的代码:
<Border BorderThickness="1" BorderBrush="DarkGray" VerticalAlignment="Center" HorizontalAlignment="Center">
<Slider Width="200" Height="100" Margin="10" Minimum="120" Maximum="255" Value="210">
<Slider.Styles>
<Style Selector="Slider:horizontal">
<Setter Property="MinWidth" Value="40" />
<Setter Property="MinHeight" Value="20" />
<Setter Property="Template">
<ControlTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" MinHeight="20" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border Grid.Row="1" Height="6" Margin="6,0" VerticalAlignment="Center"
Background="Orange" />
<Track Name="PART_Track" Grid.Row="1" Orientation="Horizontal">
<Thumb Name="thumb" MinWidth="20" MinHeight="20">
<Thumb.Template>
<ControlTemplate>
<Ellipse Width="18" Height="18" StrokeThickness="3"
Stroke="Crimson" Fill="Green" />
</ControlTemplate>
</Thumb.Template>
</Thumb>
</Track>
</Grid>
</ControlTemplate>
</Setter>
</Style>
</Slider.Styles>
</Slider>
</Border>
看上去和预期的一样,但实际上并没有滑动。甚至没有设置初始值。