GradientBrushSlider Class
Represents a slider capable of altering the stops of a GradientBrush.
[TemplatePart(Name = "PART_Spectrum", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "PART_ThumbPanel", Type = typeof(GradientBrushThumbPanel))]
public class GradientBrushSlider : Control, IOrientedElement
- Inheritance:
- object Visual UIElement FrameworkElement Control object
- Implements:
- IOrientedElement
Constructors
GradientBrushSlider()
Initializes an instance of the class.
public GradientBrushSlider()
Properties
ActiveGradientBrush
The active gradient brush to be presented by the slider.
AddStopCommand
The RoutedCommand used to add a gradient stop.
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.
Orientation
The Orientation of the slider.
public Orientation Orientation { get; set; }
Property Value
- Orientation:
The default value is Horizontal.
RemoveStopCommand
The RoutedCommand used to remove a gradient stop.
public static RoutedCommand RemoveStopCommand { get; }
Property Value
Remarks
This command will remove the gradient stop specified by the index in the command parameter. If no command parameter is provided, then the selected gradient stop will be removed, if any.
ReverseStopsCommand
The RoutedCommand used to reverse the gradient stops.
SelectedBrush
The GradientBrush that is selected in the slider. This is a dependency property.
SelectedStop
The selected gradient stop in the slider.
Methods
AddStop()
Adds a gradient stop, where appropriate.
public void AddStop()
AddStop(double)
Adds a gradient stop at the specified offset.
public void AddStop(double offset)
| Parameter | Type | Description |
|---|---|---|
| offset | double | The offset at which the gradient stop should be added. |
InvalidateThumbArrange()
Invalidates the thumb panel's arrangement.
public void InvalidateThumbArrange()
OnApplyTemplate()
When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().
public override void OnApplyTemplate()
OnSelectedBrushChanged(Brush?, Brush?)
Raises the SelectedBrushChanged event.
protected virtual void OnSelectedBrushChanged(Brush? oldValue, Brush? newValue)
| Parameter | Type | Description |
|---|---|---|
| oldValue | Brush | The old value. |
| newValue | Brush | The new value. |
RemoveSelectedStop()
Removes the selected gradient stop from the selected brush.
public bool RemoveSelectedStop()
Returns
- bool:
trueif the selected gradient stop was removed; otherwise,false.
ReverseStops()
Reverses the stops of the selected brush.
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.
Events
SelectedBrushChanged
Occurs when the value of the SelectedBrush property is changed.
public event RoutedPropertyChangedEventHandler<Brush> SelectedBrushChanged
Event Type
Fields
ActiveGradientBrushProperty
Defines the ActiveGradientBrush property.
public static readonly DependencyProperty ActiveGradientBrushProperty
CanAddStopsProperty
Defines the CanAddStops property.
public static readonly DependencyProperty CanAddStopsProperty
CanRemoveStopsProperty
Defines the CanRemoveStops property.
public static readonly DependencyProperty CanRemoveStopsProperty
OrientationProperty
Defines the Orientation property.
public static readonly DependencyProperty OrientationProperty
SelectedBrushChangedEvent
Defines the SelectedBrushChanged event.
public static readonly RoutedEvent SelectedBrushChangedEvent
SelectedBrushProperty
Defines the SelectedBrush property.
public static readonly DependencyProperty SelectedBrushProperty
SelectedStopProperty
Defines the SelectedStop property.
public static readonly DependencyProperty SelectedStopProperty