Expander
- Assembly:
Fluence.Wpf - Namespace:
Fluence.Wpf.Controls
public class Expander : System.Windows.Controls.Expander
A Fluent Design styled Expander with animated expand/collapse.
Remarks: The content reveal mirrors the WinUI 3 Expander: the content presenter slides behind the already-clipped content border by the border's measured height, sliding in over 333 ms on expand and out over 167 ms on collapse. The discrete row swap remains the layout mechanism: the content row takes its space at expand start and releases it at collapse completion, so the slide itself is cosmetic-only inside the clip.
Base type: System.Windows.Controls.Expander (including inherited WPF and .NET members)
Constructors
Expander
public Expander()
Creates a new Expander instance.
Properties
CornerRadius
public CornerRadius CornerRadius { get; set; }
Gets or sets the corner radius of the expander chrome.
HeaderBackground
public Brush? HeaderBackground { get; set; }
Gets or sets the brush that fills the header tier.
Remarks: WinUI keys the two tiers separately: the header takes ExpanderHeaderBackground and the content takes the control's own Background (Expander.xaml:111,114). This is the header half of that pair, so a consumer can colour either tier without retemplating. The default style supplies the card default fill, so leaving it unset keeps the shipped look.
Methods
OnApplyTemplate
public override void OnApplyTemplate()
Resolves the template parts that drive the content slide and applies the steady state for the current IsExpanded value without animation.
OnCollapsed
protected override void OnCollapsed()
Raises the base Collapsed event and starts the WinUI slide-out of the content behind the clipped content border, releasing the content row's layout space only when the slide completes.
OnExpanded
protected override void OnExpanded()
Raises the base Expanded event, gives the content row its layout space, and starts the WinUI slide-in of the content from behind the clipped content border.
Dependency property identifiers
Use these identifiers with WPF property APIs. The matching CLR properties appear above when the control exposes them.
CornerRadiusProperty
public static readonly DependencyProperty CornerRadiusProperty
Identifies the CornerRadius dependency property.
HeaderBackgroundProperty
public static readonly DependencyProperty HeaderBackgroundProperty
Identifies the HeaderBackground dependency property.
Fields
BottomCornerRadiusFilter
public static readonly IValueConverter BottomCornerRadiusFilter
Converter that keeps only the bottom edge of a CornerRadius or Thickness value and zeroes the top edge. The Expander template in Themes/Controls/Expander.xaml consumes this field through {x:Static controls:Expander.BottomCornerRadiusFilter}. See TopCornerRadiusFilter for why the field's declared type is the public IValueConverter interface rather than the internal converter type.
TopCornerRadiusFilter
public static readonly IValueConverter TopCornerRadiusFilter
Converter that keeps only the top edge of a CornerRadius or Thickness value and zeroes the bottom edge. The Expander template in Themes/Controls/Expander.xaml consumes this field through {x:Static controls:Expander.TopCornerRadiusFilter}. The field is declared as the public IValueConverter interface, rather than the internal converter type it constructs, because {x:Static} sites inside deferred Setter.Value and ControlTemplate content are re-resolved at runtime by StaticExtension through public-only reflection, which cannot see an internal field regardless of assembly.