In This Article

BrushEditBox Class

Represents a Brush edit box.

public class BrushEditBox : PartEditBoxBase<Brush>, 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 PartEditBoxBase<System.Windows.Media.Brush> Object

Constructors

BrushEditBox()

Initializes an instance of the BrushEditBox class.

public BrushEditBox()

Properties

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

System.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 where ValueChanged events need to fire on any update, or when binding to Value using value converters.

HasPopupButtonWhenReadOnly

Gets whether the control should display the popup button when the control is read-only.

protected override bool HasPopupButtonWhenReadOnly { get; }

Property Value

System.Boolean:

true if the control should display the popup button when the control is read-only; otherwise, false.

HasSwatch

Gets or sets whether the edit box should display a swatch that previews the Value.

public bool HasSwatch { get; set; }

Property Value

System.Boolean:

true if the edit box should display a swatch that previews the Value; otherwise, false. The default value is true.

HasText

Gets or sets whether the edit box should display a text representation of the Value.

public bool HasText { get; set; }

Property Value

System.Boolean:

true if the edit box should display a text representation of the Value; otherwise, false. The default value is true.

IsAlphaEnabled

Gets or sets whether the alpha channel (transparency) of the brush value colors are enabled.

public bool IsAlphaEnabled { get; set; }

Property Value

System.Boolean:

true if the alpha channel (transparency) of the brush value colors is enabled; otherwise, false. The default value is true.

Remarks

When disabled, no transparency is supported.

IsGradientAllowed

Gets or sets whether gradient brush values can be entered.

public bool IsGradientAllowed { get; set; }

Property Value

System.Boolean:

true if gradient brush values can be entered; otherwise, false. The default value is true.

SwatchBrush

Gets the System.Windows.Media.Brush that renders a sample swatch.

public Brush SwatchBrush { get; }

Property Value

System.Windows.Media.Brush:

The System.Windows.Media.Brush that renders a sample swatch.

SwatchMargin

Gets or sets the System.Windows.Thickness of the margin around the sample swatch.

public Thickness SwatchMargin { get; set; }

Property Value

System.Windows.Thickness:

The System.Windows.Thickness of the margin around the sample swatch.

Methods

ConvertToString(Brush)

Converts the specified value to a string representation.

protected override string ConvertToString(Brush valueToConvert)
Parameter Type Description
valueToConvert System.Windows.Media.Brush

The value.

Returns

System.String:

The string representation of the specified value.

CreateIncrementalChangeRequest(IncrementalChangeRequestKind)

Creates an incremental change (spin) request.

protected override IncrementalChangeRequest<Brush> CreateIncrementalChangeRequest(IncrementalChangeRequestKind kind)
Parameter Type Description
kind IncrementalChangeRequestKind

The kind of request.

Returns

IncrementalChangeRequest<System.Windows.Media.Brush>:

The incremental change (spin) request that was created.

GenerateParts()

Generates the parts for the edit box.

protected override IList<IPart> GenerateParts()

Returns

System.Collections.Generic.IList<IPart>:

The parts that were generated.

IsValidValue(Brush)

Returns whether the specified value is valid.

protected override bool IsValidValue(Brush value)
Parameter Type Description
value System.Windows.Media.Brush

The value to examine.

Returns

System.Boolean:

true if the value is valid; otherwise, false.

OnApplyTemplate()

Invoked whenever application code or internal processes call ApplyTemplate.

public override void OnApplyTemplate()

OnIntermediateValueChanged(Brush, Brush)

Invoked when the value of the IntermediateValue property changes.

protected override void OnIntermediateValueChanged(Brush oldValue, Brush newValue)
Parameter Type Description
oldValue System.Windows.Media.Brush

The old value of the property.

newValue System.Windows.Media.Brush

The new value of the property.

RaiseValueChangedEvent()

Raises the ValueChanged event.

protected override void RaiseValueChangedEvent()

ResetValue()

Resets the value to a default value.

protected override void ResetValue()

TryConvertFromString(String, Boolean, out Brush)

Tries to convert the specified text to a value.

protected override bool TryConvertFromString(string textToConvert, bool canCoerce, out Brush value)
Parameter Type Description
textToConvert System.String

The text.

canCoerce System.Boolean

Whether the returned value should be coerced to fall within the allowed value range.

value System.Windows.Media.Brush

Returns the value for the specified text.

Returns

System.Boolean:

true if the text was converted to a value successfully; otherwise, false.

Events

ValueChanged

Occurs after the Value property value changes.

public event EventHandler ValueChanged

Event Type

System.EventHandler

Fields

CanReuseBrushProperty

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

public static readonly DependencyProperty CanReuseBrushProperty

HasSwatchProperty

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

public static readonly DependencyProperty HasSwatchProperty

HasTextProperty

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

public static readonly DependencyProperty HasTextProperty

IsAlphaEnabledProperty

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

public static readonly DependencyProperty IsAlphaEnabledProperty

IsGradientAllowedProperty

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

public static readonly DependencyProperty IsGradientAllowedProperty

SwatchBrushProperty

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

public static readonly DependencyProperty SwatchBrushProperty

SwatchMarginProperty

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

public static readonly DependencyProperty SwatchMarginProperty

Inherited Members

Extension Methods