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
Gets or sets whether the expander will use the width measurement of collapsed content when calculating its own width. This is a dependency property.
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 isfalse
.
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
Gets or sets the Duration of the collapse animation. This is a dependency property.
public Duration CollapseDuration { get; set; }
Property Value
CollapsedVisibility
Gets or sets the Visibility of the decorator when IsExpanded is false
.
This is a dependency property.
public Visibility CollapsedVisibility { get; set; }
Property Value
- Visibility:
The Visibility of the decorator when IsExpanded is
false
. The default value isHidden
.
ExpandDirection
Gets or sets the ExpandDirection of the expansion. This is a dependency property.
public ExpandDirection ExpandDirection { get; set; }
Property Value
- ExpandDirection:
The ExpandDirection of the expansion. The default value is
ExpandDirection.Down
.
ExpandDuration
Gets or sets the Duration of the expand animation. This is a dependency property.
public Duration ExpandDuration { get; set; }
Property Value
IsAnimationEnabled
Gets or sets 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 istrue
.
IsExpanded
Gets or sets whether the contents of the decorator are expanded. This is a dependency property.
public bool IsExpanded { get; set; }
Property Value
- bool:
true
if the contents of the decorator are expanded; otherwise,false
.
Methods
ArrangeOverride(Size)
When overridden in a derived class, positions child elements and determines a size for a FrameworkElement derived class.
protected override Size ArrangeOverride(Size arrangeSize)
Parameter | Type | Description |
---|---|---|
arrangeSize | Size | The final area within the parent that this element should use to arrange itself and its children. |
Returns
- Size:
The actual size used.
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:
The object's value.
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:
The object's value.
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 availableSize)
Parameter | Type | Description |
---|---|---|
availableSize | 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.
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.
ExpansionAnimationCompleted
Occurs when the expansion animation has completed.
Fields
CanMeasureCollapsedContentProperty
Identifies the CanMeasureCollapsedContent dependency property. This field is read-only.
public static readonly DependencyProperty CanMeasureCollapsedContentProperty
CollapseAnimationCompletedEvent
Identifies the CollapseAnimationCompleted routed event. This field is read-only.
public static readonly RoutedEvent CollapseAnimationCompletedEvent
CollapseDurationProperty
Identifies the CollapseDuration dependency property. This field is read-only.
public static readonly DependencyProperty CollapseDurationProperty
CollapsedVisibilityProperty
Identifies the CollapsedVisibility dependency property. This field is read-only.
public static readonly DependencyProperty CollapsedVisibilityProperty
ExpandDirectionProperty
Identifies the ExpandDirection dependency property. This field is read-only.
public static readonly DependencyProperty ExpandDirectionProperty
ExpandDurationProperty
Identifies the ExpandDuration dependency property. This field is read-only.
public static readonly DependencyProperty ExpandDurationProperty
ExpansionAnimationCompletedEvent
Identifies the ExpansionAnimationCompleted routed event. This field is read-only.
public static readonly RoutedEvent ExpansionAnimationCompletedEvent
IsAnimationEnabledProperty
Identifies the IsAnimationEnabled dependency property.
public static readonly DependencyProperty IsAnimationEnabledProperty
IsExpandedProperty
Identifies the IsExpanded dependency property. This field is read-only.
public static readonly DependencyProperty IsExpandedProperty