In This Article

AnimatedExpanderDecorator Class

Represents a Decorator that can be used in an Expander template to provide animated content display.

public class AnimatedExpanderDecorator : Decorator
Inheritance:
object Visual UIElement FrameworkElement Decorator object

Constructors

AnimatedExpanderDecorator()

Initializes an instance of the class.

public AnimatedExpanderDecorator()

Properties

CanMeasureCollapsedContent

Indicates whether the expander will use the width measurement of collapsed content when calculating its own width.

public bool CanMeasureCollapsedContent { get; set; }

Property Value

bool:

true if the expander will use the width measurement of collapsed content when calculating its own width; otherwise, false. The default value is false.

Remarks

When true, a consistent width will be maintained when collapsed. When false, the expander will load faster (if collapsed) since less measuring is taking place.

CollapseDuration

The Duration of the collapse animation.

public Duration CollapseDuration { get; set; }

Property Value

Duration:

The default value is 150 milliseconds.

CollapsedVisibility

The Visibility of the decorator when IsExpanded is false.

public Visibility CollapsedVisibility { get; set; }

Property Value

Visibility:

The default value is Hidden.

ExpandDirection

The ExpandDirection of the expansion.

public ExpandDirection ExpandDirection { get; set; }

Property Value

ExpandDirection:

The default value is ExpandDirection.Down.

ExpandDuration

The Duration of the expand animation.

public Duration ExpandDuration { get; set; }

Property Value

Duration:

The default value is 150 milliseconds.

IsAnimationEnabled

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

public bool IsAnimationEnabled { get; set; }

Property Value

bool:

true if animations are enabled; otherwise, false. The default value is true.

IsExpanded

Indicates whether the contents of the decorator are expanded.

public bool IsExpanded { get; set; }

Property Value

bool:

true if the contents of the decorator are expanded; otherwise, false.

Methods

ArrangeOverride(Size)

Arranges the content of a Decorator element.

protected override Size ArrangeOverride(Size arrangeSize)
Parameter Type Description
arrangeSize Size

The System.Windows.Size this element uses to arrange its child content.

Returns

Size:

The System.Windows.Size that represents the arranged size of this Decorator element and its child.

GetCollapseDuration(DependencyObject)

Gets the value of the CollapseDuration attached property for the specified object.

public static Duration GetCollapseDuration(DependencyObject obj)
Parameter Type Description
obj DependencyObject

The object from which the property value is read.

Returns

Duration

GetExpandDuration(DependencyObject)

Gets the value of the ExpandDuration attached property for the specified object.

public static Duration GetExpandDuration(DependencyObject obj)
Parameter Type Description
obj DependencyObject

The object from which the property value is read.

Returns

Duration

MeasureOverride(Size)

Measures the child element of a Decorator to prepare for arranging it during the ArrangeOverride(Size) pass.

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

Returns

Size:

The target System.Windows.Size of the element.

OnCollapseAnimationCompleted()

Raises the CollapseAnimationCompleted event.

protected virtual void OnCollapseAnimationCompleted()

OnExpansionAnimationCompleted()

Raises the ExpansionAnimationCompleted event.

protected virtual void OnExpansionAnimationCompleted()

SetCollapseDuration(DependencyObject, Duration)

Sets the value of the CollapseDuration attached property to the specified object.

public static void SetCollapseDuration(DependencyObject obj, Duration value)
Parameter Type Description
obj DependencyObject

The object to which the attached property is written.

value Duration

The value to set.

SetExpandDuration(DependencyObject, Duration)

Sets the value of the ExpandDuration attached property to the specified object.

public static void SetExpandDuration(DependencyObject obj, Duration value)
Parameter Type Description
obj DependencyObject

The object to which the attached property is written.

value Duration

The value to set.

Events

CollapseAnimationCompleted

Occurs when the expansion animation has completed.

public event RoutedEventHandler CollapseAnimationCompleted

Event Type

RoutedEventHandler

ExpansionAnimationCompleted

Occurs when the expansion animation has completed.

public event RoutedEventHandler ExpansionAnimationCompleted

Event Type

RoutedEventHandler

Fields

CanMeasureCollapsedContentProperty

Defines the CanMeasureCollapsedContent property.

public static readonly DependencyProperty CanMeasureCollapsedContentProperty

CollapseAnimationCompletedEvent

Defines the CollapseAnimationCompleted event.

public static readonly RoutedEvent CollapseAnimationCompletedEvent

CollapseDurationProperty

Defines the CollapseDuration property.

public static readonly DependencyProperty CollapseDurationProperty

CollapsedVisibilityProperty

Defines the CollapsedVisibility property.

public static readonly DependencyProperty CollapsedVisibilityProperty

ExpandDirectionProperty

Defines the ExpandDirection property.

public static readonly DependencyProperty ExpandDirectionProperty

ExpandDurationProperty

Defines the ExpandDuration property.

public static readonly DependencyProperty ExpandDurationProperty

ExpansionAnimationCompletedEvent

Defines the ExpansionAnimationCompleted event.

public static readonly RoutedEvent ExpansionAnimationCompletedEvent

IsAnimationEnabledProperty

Defines the IsAnimationEnabled dependency property.

public static readonly DependencyProperty IsAnimationEnabledProperty

IsExpandedProperty

Defines the IsExpanded property.

public static readonly DependencyProperty IsExpandedProperty

Extension Methods