Table of Contents

Class SplitView

Namespace
Avalonia.Controls
Assembly
Avalonia.Controls.dll

A control with two views: A collapsible pane and an area for content

[TemplatePart("PART_PaneRoot", typeof(Panel))]
[PseudoClasses(new string[] { ":open", ":closed" })]
[PseudoClasses(new string[] { ":compactoverlay", ":compactinline", ":overlay", ":inline" })]
[PseudoClasses(new string[] { ":left", ":right" })]
[PseudoClasses(new string[] { ":lightDismiss" })]
public class SplitView : ContentControl, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue
Inheritance
SplitView
Implements
Inherited Members
Extension Methods

Constructors

SplitView()

public SplitView()

Fields

CompactPaneLengthProperty

Defines the CompactPaneLength property

public static readonly StyledProperty<double> CompactPaneLengthProperty

Field Value

StyledProperty<double>

DisplayModeProperty

Defines the DisplayMode property

public static readonly StyledProperty<SplitViewDisplayMode> DisplayModeProperty

Field Value

StyledProperty<SplitViewDisplayMode>

IsPaneOpenProperty

Defines the IsPaneOpen property

public static readonly StyledProperty<bool> IsPaneOpenProperty

Field Value

StyledProperty<bool>

OpenPaneLengthProperty

Defines the OpenPaneLength property

public static readonly StyledProperty<double> OpenPaneLengthProperty

Field Value

StyledProperty<double>

PaneBackgroundProperty

Defines the PaneBackground property

public static readonly StyledProperty<IBrush?> PaneBackgroundProperty

Field Value

StyledProperty<IBrush>

PaneClosedEvent

Defines the PaneClosed event.

public static readonly RoutedEvent<RoutedEventArgs> PaneClosedEvent

Field Value

RoutedEvent<RoutedEventArgs>

PaneClosingEvent

Defines the PaneClosing event.

public static readonly RoutedEvent<CancelRoutedEventArgs> PaneClosingEvent

Field Value

RoutedEvent<CancelRoutedEventArgs>

PaneOpenedEvent

Defines the PaneOpened event.

public static readonly RoutedEvent<RoutedEventArgs> PaneOpenedEvent

Field Value

RoutedEvent<RoutedEventArgs>

PaneOpeningEvent

Defines the PaneOpening event.

public static readonly RoutedEvent<CancelRoutedEventArgs> PaneOpeningEvent

Field Value

RoutedEvent<CancelRoutedEventArgs>

PanePlacementProperty

Defines the PanePlacement property

public static readonly StyledProperty<SplitViewPanePlacement> PanePlacementProperty

Field Value

StyledProperty<SplitViewPanePlacement>

PaneProperty

Defines the Pane property

public static readonly StyledProperty<object?> PaneProperty

Field Value

StyledProperty<object>

PaneTemplateProperty

Defines the PaneTemplate property.

public static readonly StyledProperty<IDataTemplate> PaneTemplateProperty

Field Value

StyledProperty<IDataTemplate>

TemplateSettingsProperty

Defines the TemplateSettings property

public static readonly DirectProperty<SplitView, SplitViewTemplateSettings> TemplateSettingsProperty

Field Value

DirectProperty<SplitView, SplitViewTemplateSettings>

UseLightDismissOverlayModeProperty

Defines the UseLightDismissOverlayMode property

public static readonly StyledProperty<bool> UseLightDismissOverlayModeProperty

Field Value

StyledProperty<bool>

Properties

CompactPaneLength

Gets or sets the length of the pane when in CompactOverlay or CompactInline mode

public double CompactPaneLength { get; set; }

Property Value

double

DisplayMode

Gets or sets the SplitViewDisplayMode for the SplitView

public SplitViewDisplayMode DisplayMode { get; set; }

Property Value

SplitViewDisplayMode

IsPaneOpen

Gets or sets whether the pane is open or closed

public bool IsPaneOpen { get; set; }

Property Value

bool

OpenPaneLength

Gets or sets the length of the pane when open

public double OpenPaneLength { get; set; }

Property Value

double

Pane

Gets or sets the Pane for the SplitView

[DependsOn("PaneTemplate")]
public object? Pane { get; set; }

Property Value

object

PaneBackground

Gets or sets the background of the pane

public IBrush? PaneBackground { get; set; }

Property Value

IBrush

PanePlacement

Gets or sets the SplitViewPanePlacement for the SplitView

public SplitViewPanePlacement PanePlacement { get; set; }

Property Value

SplitViewPanePlacement

PaneTemplate

Gets or sets the data template used to display the header content of the control.

public IDataTemplate PaneTemplate { get; set; }

Property Value

IDataTemplate

TemplateSettings

Gets or sets the TemplateSettings for the SplitView.

public SplitViewTemplateSettings TemplateSettings { get; }

Property Value

SplitViewTemplateSettings

UseLightDismissOverlayMode

Gets or sets whether WinUI equivalent LightDismissOverlayMode is enabled

When enabled, and the pane is open in Overlay or CompactOverlay mode, the contents of the SplitView are darkened to visually separate the open pane and the rest of the SplitView.

public bool UseLightDismissOverlayMode { get; set; }

Property Value

bool

Methods

OnApplyTemplate(TemplateAppliedEventArgs)

Called when the control's template is applied. In simple terms, this means the method is called just before the control is displayed.

protected override void OnApplyTemplate(TemplateAppliedEventArgs e)

Parameters

e TemplateAppliedEventArgs

The event args.

OnAttachedToVisualTree(VisualTreeAttachmentEventArgs)

Called when the control is added to a rooted visual tree.

protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)

Parameters

e VisualTreeAttachmentEventArgs

The event args.

OnCoerceIsPaneOpen(bool)

Called when the IsPaneOpen property has to be coerced.

protected virtual bool OnCoerceIsPaneOpen(bool value)

Parameters

value bool

The value to coerce.

Returns

bool

OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs)

Called when the control is removed from a rooted visual tree.

protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)

Parameters

e VisualTreeAttachmentEventArgs

The event args.

OnKeyDown(KeyEventArgs)

Called before the KeyDown event occurs.

protected override void OnKeyDown(KeyEventArgs e)

Parameters

e KeyEventArgs

The event args.

OnPaneClosed(RoutedEventArgs)

protected virtual void OnPaneClosed(RoutedEventArgs args)

Parameters

args RoutedEventArgs

OnPaneClosing(CancelRoutedEventArgs)

protected virtual void OnPaneClosing(CancelRoutedEventArgs args)

Parameters

args CancelRoutedEventArgs

OnPaneOpened(RoutedEventArgs)

protected virtual void OnPaneOpened(RoutedEventArgs args)

Parameters

args RoutedEventArgs

OnPaneOpening(CancelRoutedEventArgs)

protected virtual void OnPaneOpening(CancelRoutedEventArgs args)

Parameters

args CancelRoutedEventArgs

OnPropertyChanged(AvaloniaPropertyChangedEventArgs)

Called when a avalonia property changes on the object.

protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)

Parameters

change AvaloniaPropertyChangedEventArgs

The property change details.

RegisterContentPresenter(ContentPresenter)

Called when an ContentPresenter is registered with the control.

protected override bool RegisterContentPresenter(ContentPresenter presenter)

Parameters

presenter ContentPresenter

The presenter.

Returns

bool

Events

PaneClosed

Fired when the pane is closed.

public event EventHandler<RoutedEventArgs>? PaneClosed

Event Type

EventHandler<RoutedEventArgs>

PaneClosing

Fired when the pane is closing.

public event EventHandler<CancelRoutedEventArgs>? PaneClosing

Event Type

EventHandler<CancelRoutedEventArgs>

Remarks

The event args Cancel property may be set to true to cancel the event and keep the pane open.

PaneOpened

Fired when the pane is opened.

public event EventHandler<RoutedEventArgs>? PaneOpened

Event Type

EventHandler<RoutedEventArgs>

PaneOpening

Fired when the pane is opening.

public event EventHandler<CancelRoutedEventArgs>? PaneOpening

Event Type

EventHandler<CancelRoutedEventArgs>

Remarks

The event args Cancel property may be set to true to cancel the event and keep the pane closed.