In This Article

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.

public Brush? ActiveBrush { get; set; }

Property Value

Brush

AddStopCommand

The ICommand that calls the AddStop() method.

public ICommand AddStopCommand { get; }

Property Value

ICommand

CanAddStops

Indicates whether stops can be added.

public bool CanAddStops { get; set; }

Property Value

bool:

true if stops can be added; otherwise, false. The default value is true.

CanRemoveStops

Indicates whether stops can be removed.

public bool CanRemoveStops { get; set; }

Property Value

bool:

true if stops can be removed; otherwise, false. The default value is true.

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:

true if the Brush value 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 is true.

Remarks

Set this to false in scenarios when binding to ActiveBrush using value converters.

RemoveSelectedStopCommand

The ICommand that calls the RemoveSelectedStop() method.

public ICommand RemoveSelectedStopCommand { get; }

Property Value

ICommand

ReverseStopsCommand

The ICommand that calls the ReverseStops() method.

public ICommand ReverseStopsCommand { get; }

Property Value

ICommand

SelectedColor

The currently selected Color.

public Color SelectedColor { get; set; }

Property Value

Color

SelectedStopIndex

The index of the selected stop.

public int SelectedStopIndex { get; set; }

Property Value

int

TrackGradientBrush

The resolved GradientBrush to render in the track and adjust with the slider.

public GradientBrush? TrackGradientBrush { get; }

Property Value

GradientBrush

TrackHeight

The height of the slider track.

public double TrackHeight { get; set; }

Property Value

double:

The default value is 12.

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

Extension Methods