GradientBrushSlider Class
Represents a slider capable of altering the stops of a System.Windows.Media.GradientBrush.
[TemplatePart(Name = "PART_Spectrum", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "PART_ThumbPanel", Type = typeof(GradientBrushThumbPanel))]
public class GradientBrushSlider : Control, DUCE.IResource, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IHaveResources, IQueryAmbient
- Inheritance:
- System.Object System.Windows.Threading.DispatcherObject System.Windows.DependencyObject System.Windows.Media.Visual System.Windows.UIElement System.Windows.FrameworkElement System.Windows.Controls.Control Object
Remarks
For detailed documentation on this control's features and how to use them, please see the Shared Color Selection documentation topic.
Constructors
GradientBrushSlider()
Initializes an instance of the GradientBrushSlider
class.
public GradientBrushSlider()
Properties
ActiveGradientBrush
Gets the active gradient brush to be presented by the slider. This is a dependency property.
public Brush ActiveGradientBrush { get; }
Property Value
- System.Windows.Media.Brush:
The active gradient brush to be presented by the slider. The default value is
null
.
AddStopCommand
Gets the System.Windows.Input.RoutedCommand used to add a gradient stop.
public static RoutedCommand AddStopCommand { get; }
Property Value
- System.Windows.Input.RoutedCommand:
The System.Windows.Input.RoutedCommand.
CanAddStops
Gets or sets the whether stops can be added. This is a dependency property.
public bool CanAddStops { get; set; }
Property Value
- System.Boolean:
true
if stops can be added; otherwise,false
. The default value istrue
.
CanRemoveStops
Gets or sets the whether stops can be removed. This is a dependency property.
public bool CanRemoveStops { get; set; }
Property Value
- System.Boolean:
true
if stops can be removed; otherwise,false
. The default value istrue
.
Orientation
Gets or sets the Orientation of the slider. This is a dependency property.
public Orientation Orientation { get; set; }
Property Value
- System.Windows.Controls.Orientation:
The Orientation of the slider. The default value is
Orientation.Horizontal
.
RemoveStopCommand
Gets the System.Windows.Input.RoutedCommand used to remove a gradient stop.
public static RoutedCommand RemoveStopCommand { get; }
Property Value
- System.Windows.Input.RoutedCommand:
The System.Windows.Input.RoutedCommand.
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
Gets the System.Windows.Input.RoutedCommand used to reverse the gradient stops.
public static RoutedCommand ReverseStopsCommand { get; }
Property Value
- System.Windows.Input.RoutedCommand:
The System.Windows.Input.RoutedCommand.
SelectedBrush
Gets or sets the System.Windows.Media.GradientBrush that is selected in the slider. This is a dependency property.
public Brush SelectedBrush { get; set; }
Property Value
- System.Windows.Media.Brush:
The System.Windows.Media.Color that is selected in the slider. The default value is
null
.
SelectedStop
Gets the selected gradient stop in the slider. This is a dependency property.
public GradientStop SelectedStop { get; }
Property Value
- System.Windows.Media.GradientStop:
The selected gradient stop in the slider. The default value is
null
.
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 | System.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 | System.Windows.Media.Brush | The old value. |
newValue | System.Windows.Media.Brush | The new value. |
RemoveSelectedStop()
Removes the selected gradient stop from the selected brush.
public bool RemoveSelectedStop()
Returns
- System.Boolean:
true
if 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
- System.Windows.RoutedPropertyChangedEventHandler<System.Windows.Media.Brush>
Fields
ActiveGradientBrushProperty
Identifies the read-only ActiveGradientBrush dependency property. This field is read-only.
public static readonly DependencyProperty ActiveGradientBrushProperty
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
OrientationProperty
Identifies the Orientation dependency property. This field is read-only.
public static readonly DependencyProperty OrientationProperty
SelectedBrushChangedEvent
Identifies the SelectedBrushChanged routed event. This field is read-only.
public static readonly RoutedEvent SelectedBrushChangedEvent
SelectedBrushProperty
Identifies the SelectedBrush dependency property. This field is read-only.
public static readonly DependencyProperty SelectedBrushProperty
SelectedStopProperty
Identifies the read-only SelectedStop dependency property. This field is read-only.
public static readonly DependencyProperty SelectedStopProperty
Inherited Members
- System.Object.ToString()
- System.Object.Equals(System.Object)
- System.Object.Equals(System.Object, System.Object)
- System.Object.ReferenceEquals(System.Object, System.Object)
- System.Object.GetHashCode()
- System.Object.GetType()
- System.Object.MemberwiseClone()
Extension Methods
- FrameworkElementExtensions.AnimateDoubleProperty(String, Double, Double, Double, Nullable<Double>, Nullable<Double>)
- FrameworkElementExtensions.BindToProperty(DependencyProperty, Object, String, BindingMode, IValueConverter, Object)
- FrameworkElementExtensions.BindToProperty(DependencyProperty, Object, DependencyProperty, BindingMode, IValueConverter, Object)
- FrameworkElementExtensions.GetCurrentSize()