[]
The following quick start guide is intended to get you up and running with RangeSlider for WPF. In this quick start, you add a C1RangeSlider control to your application and customize the appearance and behavior of the control.
<Rectangle Name="rectangle1" Stroke="Black">
<Rectangle.Fill>
<RadialGradientBrush x:Name="colors">
<GradientStop x:Name="goldcol" Color="Gold" Offset="0" />
<GradientStop x:Name="blackcol" Color="Black" Offset="1" />
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
This will add a black and gold radial gradient fill to the rectangle.
You've successfully created a WPF application and customized the Rectangle control. In the next step you'll add and customize the C1RangeSlider control.
In the previous step you created a new WPF project and added a Rectangle control with a gradient to the application. In this step you'll continue by adding a C1RangeSlider control that will control the gradient fill in the Rectangle.
Complete the following steps:
<c1:C1RangeSlider x:Name="c1rs1">
By giving it a unique identifier, you'll be able to access the control in code.
<c1:C1RangeSlider x:Name="c1rs1" Margin="380,50,399,50">
This will set each edge the same distance away from the grid's border.
<c1:C1RangeSlider x:Name="c1rs1" Margin="380,50,399,50" Orientation="Vertical">
By default Orientation is Horizontal and the control appears across the page.
<c1:C1RangeSlider x:Name="c1rs1" Margin="380,50,399,50" Orientation="Vertical" UpperValue="1">
The upper thumb will now begin at 1.
<c1:C1RangeSlider x:Name="c1rs1" Margin="380,50,399,50" Orientation="Vertical" UpperValue="1" Maximum="1">
Users will now not be able to select a value greater than 1.
<c1:C1RangeSlider x:Name="c1rs1" Margin="380,50,399,50" Orientation="Vertical" UpperValue="1" Maximum="1" ValueChange="0.1">
When you click on the slider track at run time, the slider thumb will now move by 0.1 units.
<c1:C1RangeSlider x:Name="c1rs1" Margin="380,50,399,50" Orientation="Vertical" UpperValue="1" Maximum="1" ValueChange="0.1" Opacity="0.8">
By default this property is set to 1 and the control appears completely opaque. Changing this to a lower number will make the control appear slightly transparent.
<c1:C1RangeSlider x:Name="c1rs1" Margin="380,50,399,50" Orientation="Vertical" UpperValue="1" Maximum="1" ValueChange="0.1" Opacity="0.8" LowerValueChanged="c1rs1_LowerValueChanged" UpperValueChanged="c1rs1_UpperValueChanged">
You'll add code for these event handlers in a later step.
You've successfully set up your application's user interface, but right now the slider will do nothing if you move it. In the next step you'll add code to your application to add functionality.
In the previous steps you set up the application's user interface and added controls to your application. In this step you'll add code to your application to finalize it.
Complete the following steps:
Imports C1.WPF.Input
using C1.WPF.Input;
Private Sub Window1_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
UpdateGradient()
End Sub
private void Window_Loaded(object sender, RoutedEventArgs e)
{
UpdateGradient();
}
Private Sub UpdateGradient()
If IsLoaded Then
Me.goldcol.Offset = Me.c1rs1.LowerValue
Me.blackcol.Offset = Me.c1rs1.UpperValue
End If
End Sub
UpdateGradient()
{
if (IsLoaded)
{
this.goldcol.Offset = this.c1rs1.LowerValue;
this.blackcol.Offset = this.c1rs1.UpperValue;
}
}
Private Sub c1rs1_LowerValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles c1rs1.LowerValueChanged
UpdateGradient()
End Sub
private void c1rs1_LowerValueChanged(object sender, EventArgs e)
{
UpdateGradient();
}
Private Sub c1rs1_UpperValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles c1rs1.UpperValueChanged
UpdateGradient()
End Sub
c1rs1_UpperValueChanged(object sender, EventArgs e)
{
UpdateGradient();
}
In this step you completed adding code to your application. In the next step you'll run the application and observe run-time interactions.
Now that you've created a WPF application and customized the application's appearance and behavior, the only thing left to do is run your application.
To run your application and observe RangeSlider for WPF's run-time behavior, complete the following steps:
The application will appear similar to the following:
Congratulations!
You've completed the RangeSlider for WPF quick start and created a RangeSlider for WPF application, customized the appearance and behavior of the controls, and viewed some of the run-time capabilities of your application.