Skip to content

Commit

Permalink
add SplitView bindings.
Browse files Browse the repository at this point in the history
  • Loading branch information
SilkyFowl committed May 14, 2024
1 parent 9b4a6fa commit cd4d413
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/Avalonia.FuncUI/DSL/SplitView.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
[<AutoOpen>]
module SplitView =
open Avalonia.Controls
open Avalonia.Controls.Templates
open Avalonia.Interactivity
open Avalonia.Media
open Avalonia.Media.Immutable
open Avalonia.FuncUI.Types
Expand All @@ -11,7 +13,19 @@ module SplitView =
let create (attrs: IAttr<SplitView> list): IView<SplitView> =
ViewBuilder.Create<SplitView>(attrs)

type SplitView with
type SplitView with

static member onPaneClosed<'t when 't :> SplitView>(func: RoutedEventArgs -> unit, ?subPatchOptions) =
AttrBuilder<'t>.CreateSubscription<RoutedEventArgs>(SplitView.PaneClosedEvent, func, ?subPatchOptions = subPatchOptions)

static member onPaneClosing<'t when 't :> SplitView>(func: CancelRoutedEventArgs -> unit, ?subPatchOptions) =
AttrBuilder<'t>.CreateSubscription<CancelRoutedEventArgs>(SplitView.PaneClosingEvent, func, ?subPatchOptions = subPatchOptions)

static member onPaneOpened<'t when 't :> SplitView>(func: RoutedEventArgs -> unit, ?subPatchOptions) =
AttrBuilder<'t>.CreateSubscription<RoutedEventArgs>(SplitView.PaneOpenedEvent, func, ?subPatchOptions = subPatchOptions)

static member onPaneOpening<'t when 't :> SplitView>(func: CancelRoutedEventArgs -> unit, ?subPatchOptions) =
AttrBuilder<'t>.CreateSubscription<CancelRoutedEventArgs>(SplitView.PaneOpeningEvent, func, ?subPatchOptions = subPatchOptions)

static member content<'t when 't :> SplitView>(value: IView option) : IAttr<'t> =
AttrBuilder<'t>.CreateContentSingle(SplitView.ContentProperty, value)
Expand Down Expand Up @@ -49,6 +63,9 @@ module SplitView =
static member pane<'t when 't :> SplitView>(value: IView) : IAttr<'t> =
value |> Some |> SplitView.pane

static member paneTemplate<'t when 't :> SplitView>(value: IDataTemplate) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<IDataTemplate>(SplitView.PaneTemplateProperty, value, ValueNone)

static member useLightDismissOverlayMode<'t when 't :> SplitView>(value: bool) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<bool>(SplitView.UseLightDismissOverlayModeProperty, value, ValueNone)

Expand Down

0 comments on commit cd4d413

Please sign in to comment.