GradientStopSlider Class
A slider for manipulating gradient stops.
[TemplatePart(Name = "PART_Checkerboard", Type = typeof(Path))]
[TemplatePart(Name = "PART_Panel", Type = typeof(Panel))]
public class GradientStopSlider : Control
- Inheritance:
- object Visual UIElement FrameworkElement Control object
Constructors
GradientStopSlider()
Initializes an instance of the class.
public GradientStopSlider()
Properties
ActiveBrush
The Brush to render and adjust with the slider.
AddStopCommand
CanAddStops
Indicates whether stops can be added.
public bool CanAddStops { get; set; }
Property Value
- bool:
trueif stops can be added; otherwise,false. The default value istrue.
CanRemoveStops
Indicates whether stops can be removed.
public bool CanRemoveStops { get; set; }
Property Value
- bool:
trueif stops can be removed; otherwise,false. The default value istrue.
CanReuseBrush
Indicates whether the Brush value can simply have components like gradient stops updated instead of requiring a new brush to be created on any update.
public bool CanReuseBrush { get; set; }
Property Value
- bool:
trueif theBrushvalue can simply have components like gradient stops updated instead of requiring a new brush to be created on any update; otherwise,false. The default value istrue.
Remarks
Set this to false in scenarios when binding to ActiveBrush using value converters.
RemoveSelectedStopCommand
The ICommand that calls the RemoveSelectedStop() method.
ReverseStopsCommand
The ICommand that calls the ReverseStops() method.
SelectedColor
The currently selected Color.
SelectedStopIndex
The index of the selected stop.
TrackGradientBrush
The resolved GradientBrush to render in the track and adjust with the slider.
TrackHeight
The height of the slider track.
Methods
AddStop()
Adds a new gradient stop.
public void AddStop()
AddStop(double?)
Adds a new gradient stop.
public void AddStop(double? stopOffset)
| Parameter | Type | Description |
|---|---|---|
| stopOffset | double? | The optional specific offset for the new gradient stop. |
MeasureOverride(Size)
Called to remeasure a control.
protected override Size MeasureOverride(Size constraint)
| Parameter | Type | Description |
|---|---|---|
| constraint | Size | The maximum size that the method can return. |
Returns
- Size:
The size of the control, up to the maximum specified by
constraint.
OnApplyTemplate()
When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().
public override void OnApplyTemplate()
OnCreateAutomationPeer()
Returns class-specific AutomationPeer implementations for the Windows Presentation Foundation (WPF) infrastructure.
protected override AutomationPeer OnCreateAutomationPeer()
Returns
- AutomationPeer:
The type-specific AutomationPeer implementation.
Refresh()
Refreshes the control, such as when an external change is made to ActiveBrush that is unable to be detected.
public void Refresh()
RemoveSelectedStop()
Removes the selected gradient stop.
public void RemoveSelectedStop()
ReverseStops()
Reverses the gradient stops in the ActiveBrush.
public void ReverseStops()
Remarks
Gradient stops at offset 1.0 will be moved to offset 0.0 gradient stops at offset 0.0 will be moved to offset 1.0. Gradient stops at offset 0.5 will not be changed.
Fields
ActiveBrushProperty
Defines the ActiveBrush property.
public static readonly DependencyProperty ActiveBrushProperty
CanAddStopsProperty
Defines the CanAddStops property.
public static readonly DependencyProperty CanAddStopsProperty
CanRemoveStopsProperty
Defines the CanRemoveStops property.
public static readonly DependencyProperty CanRemoveStopsProperty
CanReuseBrushProperty
Defines the CanReuseBrush property.
public static readonly DependencyProperty CanReuseBrushProperty
SelectedColorProperty
Defines the SelectedColor property.
public static readonly DependencyProperty SelectedColorProperty
SelectedStopIndexProperty
Defines the SelectedStopIndex property.
public static readonly DependencyProperty SelectedStopIndexProperty
TrackGradientBrushProperty
Defines the TrackGradientBrush property.
public static readonly DependencyProperty TrackGradientBrushProperty
TrackHeightProperty
Defines the TrackHeight property.
public static readonly DependencyProperty TrackHeightProperty