In This Article

Badge Class

Represents a descriptor typically used as status indicator.

[TemplatePart(Name = "PART_RootContent", Type = typeof(FrameworkElement))]
public class Badge : ContentControl
Inheritance:
object Visual UIElement FrameworkElement Control ContentControl object
Derived:
NumericBadge

Constructors

Badge()

Initializes an instance of the class.

public Badge()

Properties

CornerRadius

The corner radius of the element.

public CornerRadius CornerRadius { get; set; }

Property Value

CornerRadius

DotLength

The width and height of the "dot" element when displayed as Dot.

public double DotLength { get; set; }

Property Value

double

IsActive

Indicates if the badge is currently active.

public bool IsActive { get; set; }

Property Value

bool:

The default value is true.

IsAnimationEnabled

Indicates whether animations are enabled for an element, when supported.

public bool IsAnimationEnabled { get; set; }

Property Value

bool:

The default value is true.

IsEffectivelyDot

Indicates whether the badge is effectively displayed as a Dot.

public bool IsEffectivelyDot { get; }

Property Value

bool

Kind

Indicates the kind of badge to be displayed.

public BadgeKind Kind { get; set; }

Property Value

BadgeKind:

The default value is Default.

Methods

CoerceAllProperties()

Requests all coerced properties to be coerced.

protected virtual void CoerceAllProperties()

MeasureOverride(Size)

Called to remeasure a control.

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

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.

OnPropertyChanged(DependencyPropertyChangedEventArgs)

Invoked whenever the effective value of any dependency property on this FrameworkElement has been updated. The specific dependency property that changed is reported in the arguments parameter. Overrides System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs).

protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
Parameter Type Description
e DependencyPropertyChangedEventArgs

The event data that describes the property that changed, as well as old and new values.

ToString()

Returns the string representation of this object.

public override string ToString()

Returns

string:

The string representation of this object.

Fields

CornerRadiusProperty

Defines the CornerRadius property.

public static readonly DependencyProperty CornerRadiusProperty

DotLengthProperty

Defines the DotLength property.

public static readonly DependencyProperty DotLengthProperty

IsActiveProperty

Defines the IsActive property.

public static readonly DependencyProperty IsActiveProperty

IsAnimationEnabledProperty

Defines the IsAnimationEnabled property.

public static readonly DependencyProperty IsAnimationEnabledProperty

IsEffectivelyDotProperty

Defines the IsEffectivelyDot property.

public static readonly DependencyProperty IsEffectivelyDotProperty

KindProperty

Defines the Kind property.

public static readonly DependencyProperty KindProperty

Extension Methods