<UserControl x:Class="SliderMaxValueTest.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="400" Height="300">
<Grid x:Name="LayoutRoot" Background="White" ShowGridLines="True">
<Grid.RowDefinitions>
<RowDefinition Height="150" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Slider Maximum="255" Minimum="0" Value="100.0" Grid.Row="0" x:Name="sld" Orientation="Vertical" MaxHeight="300" ValueChanged="Slider_ValueChanged"/>
<TextBlock x:Name="Val" Grid.Row="1" Width="200" />
</Grid>
</UserControl>
namespace SliderMaxValueTest

{
public partial class Page : UserControl
{
public Page()
{
InitializeComponent();
}
private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
Val.Text = e.NewValue.ToString();
}
}
}狐的传说