<Window x:Class="WPF滑块的使用.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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"
xmlns:local="clr-namespace:WPF滑块的使用"
mc:Ignorable="d"
Title="Slider用法测试" Height="200" Width="300" WindowStartupLocation="CenterScreen" Background="#FF005087">
<Grid Height="172" VerticalAlignment="Top">
<Grid Margin="12,22,0,124" HorizontalAlignment="Left" Width="76"/>
<Slider x:Name="Slider1" Margin="50,65,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="195" Maximum="28" TickPlacement="BottomRight" SmallChange="1" IsSnapToTickEnabled="True" Minimum="8" Value="12">
<Slider.Effect>
<DropShadowEffect/>
</Slider.Effect>
</Slider>
<Grid Margin="10,116,10,0" Height="46" VerticalAlignment="Top"/>
<Label x:Name="Label1" Content="测试" FontSize="{Binding Value, ElementName=Slider1}" HorizontalAlignment="Left" Margin="114,10,0,0" VerticalAlignment="Top" Height="50" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Width="66" Foreground="White"/>
<TextBlock HorizontalAlignment="Left" Margin="52,89,0,0" TextWrapping="Wrap" Text="{Binding Minimum, ElementName=Slider1}" VerticalAlignment="Top" Width="20" Foreground="#FF7D7D7D"/>
<TextBlock HorizontalAlignment="Left" Margin="118,89,0,0" TextWrapping="Wrap" Text="{Binding Value, ElementName=Slider1}" VerticalAlignment="Top" Width="60" TextAlignment="Center" Foreground="White" FontSize="13"/>
<TextBlock HorizontalAlignment="Left" Margin="226,89,0,0" TextWrapping="Wrap" Text="{Binding Maximum, ElementName=Slider1}" VerticalAlignment="Top" Width="20" Foreground="#FF7D7D7D" TextAlignment="Right"/>
</Grid>
</Window>
WPF Slider滑块的值绑定
最新推荐文章于 2023-04-03 20:48:29 发布