using Avalonia.Controls.Metadata;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Input.Raw;
using Avalonia.Interactivity;
using Avalonia.Media;
using Avalonia.Metadata;
using Avalonia.Platform;
using Avalonia.VisualTree;
using System;
using System.Reactive.Disposables;
using Avalonia.Controls.Presenters;
using Avalonia.Controls.Templates;
namespace Avalonia.Controls
{
///
/// Defines constants for how the SplitView Pane should display
///
public enum SplitViewDisplayMode
{
///
/// Pane is displayed next to content, and does not auto collapse
/// when tapped outside
///
Inline,
///
/// Pane is displayed next to content. When collapsed, pane is still
/// visible according to CompactPaneLength. Pane does not auto collapse
/// when tapped outside
///
CompactInline,
///
/// Pane is displayed above content. Pane collapses when tapped outside
///
Overlay,
///
/// Pane is displayed above content. When collapsed, pane is still
/// visible according to CompactPaneLength. Pane collapses when tapped outside
///
CompactOverlay
}
///
/// Defines constants for where the Pane should appear
///
public enum SplitViewPanePlacement
{
Left,
Right
}
public class SplitViewTemplateSettings : AvaloniaObject
{
internal SplitViewTemplateSettings() { }
public static readonly StyledProperty ClosedPaneWidthProperty =
AvaloniaProperty.Register(nameof(ClosedPaneWidth), 0d);
public static readonly StyledProperty PaneColumnGridLengthProperty =
AvaloniaProperty.Register(nameof(PaneColumnGridLength));
public double ClosedPaneWidth
{
get => GetValue(ClosedPaneWidthProperty);
internal set => SetValue(ClosedPaneWidthProperty, value);
}
public GridLength PaneColumnGridLength
{
get => GetValue(PaneColumnGridLengthProperty);
internal set => SetValue(PaneColumnGridLengthProperty, value);
}
}
///
/// A control with two views: A collapsible pane and an area for content
///
[PseudoClasses(":open", ":closed")]
[PseudoClasses(":compactoverlay", ":compactinline", ":overlay", ":inline")]
[PseudoClasses(":left", ":right")]
[PseudoClasses(":lightdismiss")]
public class SplitView : ContentControl
{
/*
Pseudo classes & combos
:open / :closed
:compactoverlay :compactinline :overlay :inline
:left :right
*/
///
/// Defines the property
///
public static readonly StyledProperty CompactPaneLengthProperty =
AvaloniaProperty.Register(nameof(CompactPaneLength), defaultValue: 48);
///
/// Defines the property
///
public static readonly StyledProperty DisplayModeProperty =
AvaloniaProperty.Register(nameof(DisplayMode), defaultValue: SplitViewDisplayMode.Overlay);
///
/// Defines the property
///
public static readonly DirectProperty IsPaneOpenProperty =
AvaloniaProperty.RegisterDirect(nameof(IsPaneOpen),
x => x.IsPaneOpen, (x, v) => x.IsPaneOpen = v);
///
/// Defines the property
///
public static readonly StyledProperty OpenPaneLengthProperty =
AvaloniaProperty.Register(nameof(OpenPaneLength), defaultValue: 320);
///
/// Defines the property
///
public static readonly StyledProperty PaneBackgroundProperty =
AvaloniaProperty.Register(nameof(PaneBackground));
///
/// Defines the property
///
public static readonly StyledProperty PanePlacementProperty =
AvaloniaProperty.Register(nameof(PanePlacement));
///
/// Defines the property
///
public static readonly StyledProperty