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, DUCE.IResource, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IHaveResources, IQueryAmbient
Inheritance:
Object DispatcherObject DependencyObject Visual UIElement FrameworkElement Control Object

Constructors

GradientStopSlider()

Initializes an instance of the GradientStopSlider class.

public GradientStopSlider()

Properties

ActiveBrush

Gets or sets the Brush to render and adjust with the slider.

public Brush ActiveBrush { get; set; }

Property Value

Brush:

The Brush to render and adjust with the slider.

AddStopCommand

Gets the ICommand that calls the AddStop() method.

public ICommand AddStopCommand { get; }

Property Value

ICommand:

The ICommand that calls the AddStop() method.

CanAddStops

Gets or sets whether stops can be added.

public bool CanAddStops { get; set; }

Property Value

Boolean:

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

CanRemoveStops

Gets or sets whether stops can be removed.

public bool CanRemoveStops { get; set; }

Property Value

Boolean:

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

CanReuseBrush

Gets or sets 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

Boolean:

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

Gets the ICommand that calls the RemoveSelectedStop() method.

public ICommand RemoveSelectedStopCommand { get; }

Property Value

ICommand:

The ICommand that calls the RemoveSelectedStop() method.

ReverseStopsCommand

Gets the ICommand that calls the ReverseStops() method.

public ICommand ReverseStopsCommand { get; }

Property Value

ICommand:

The ICommand that calls the ReverseStops() method.

SelectedColor

Gets or sets the currently selected Color.

public Color SelectedColor { get; set; }

Property Value

Color:

The currently selected Color.

SelectedStopIndex

Gets or sets the index of the selected stop.

public int SelectedStopIndex { get; set; }

Property Value

Int32:

The index of the selected stop.

TrackGradientBrush

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

public GradientBrush TrackGradientBrush { get; }

Property Value

GradientBrush:

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

TrackHeight

Gets or sets the height of the slider track.

public double TrackHeight { get; set; }

Property Value

Double:

The height of the slider track. The default value is 12.

Methods

AddStop()

Adds a new gradient stop.

public void AddStop()

AddStop(Nullable<Double>)

Adds a new gradient stop.

public void AddStop(double? stopOffset)
Parameter Type Description
stopOffset Nullable<Double>

The optional specific offset for the new gradient stop.

MeasureOverride(Size)

When overridden in a derived class, measures the size in layout required for child elements and determines a size for the FrameworkElement-derived class.

protected override Size MeasureOverride(Size constraint)
Parameter Type Description
constraint Size

The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available.

Returns

Size:

The size that this element determines it needs during layout, based on its calculations of child element sizes.

OnApplyTemplate()

Invoked whenever application code or internal processes call ApplyTemplate.

public override void OnApplyTemplate()

OnCreateAutomationPeer()

Returns an AutomationPeer object for this control instance.

protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer:

An AutomationPeer instance.

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

Identifies the ActiveBrush dependency property. This field is read-only.

public static readonly DependencyProperty ActiveBrushProperty

CanAddStopsProperty

Identifies the CanAddStops dependency property. This field is read-only.

public static readonly DependencyProperty CanAddStopsProperty

CanRemoveStopsProperty

Identifies the CanRemoveStops dependency property. This field is read-only.

public static readonly DependencyProperty CanRemoveStopsProperty

CanReuseBrushProperty

Identifies the CanReuseBrush dependency property. This field is read-only.

public static readonly DependencyProperty CanReuseBrushProperty

SelectedColorProperty

Identifies the SelectedColor dependency property. This field is read-only.

public static readonly DependencyProperty SelectedColorProperty

SelectedStopIndexProperty

Identifies the SelectedStopIndex dependency property. This field is read-only.

public static readonly DependencyProperty SelectedStopIndexProperty

TrackGradientBrushProperty

Identifies the TrackGradientBrush dependency property. This field is read-only.

public static readonly DependencyProperty TrackGradientBrushProperty

TrackHeightProperty

Identifies the TrackHeight dependency property. This field is read-only.

public static readonly DependencyProperty TrackHeightProperty

Inherited Members

Extension Methods