SliderTest.axaml代码
<Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Height="252" Width="482" x:Class="AvaloniaUI.SliderTest" Title="SliderTest"> <StackPanel> <TextBlock Margin="10" TextWrapping="Wrap"> Try clicking on either side of the thumb and holding down the mouse button. Value will be <InlineUIContainer> <TextBlock Text="{Binding #slider.Value}"/> </InlineUIContainer> </TextBlock> <Slider Name="slider" Margin="10" TickFrequency="1" TickPlacement="TopLeft" Maximum="10" IsSnapToTickEnabled="True"> </Slider> </StackPanel> </Window>
SliderTest.axaml.cs代码
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace AvaloniaUI;
public partial class SliderTest : Window
{
public SliderTest()
{
InitializeComponent();
}
}
运行效果

浙公网安备 33010602011771号