fabulous-dev / Fabulous

Declarative UI framework for cross-platform mobile & desktop apps, using MVU and F# functional programming

Home Page:https://fabulous.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Better support for Behaviors

TimLariviere opened this issue · comments

Fabulous does not natively let us extend an element with Xamarin.Forms.Behaviors.
The only way, today, is to get access to the underlying Xamarin.Forms control through created and set the behavior directly there.

It would be nice to have a better integration for this.

Use case

See #827 (comment) for an example.

Proposal

type EntryBehavior() =
    inherit Xamarin.Forms.Behavior()
    (...)

type View with
    static member EntryBehavior() =
        let create () = new EntryBehavior()
        (...)

View.Entry(
    text = entryText,
    behaviors = [
        View.EntryBehavior() // behavior used here
    ]
)

v2 now supports extension methods very easily. Closing this issue