Skip to content

UIKeyboard.Notifications members are unpleasant to use from F# #1

Description

@dvdsgl

For example, to handle UIKeyboard.WillShowNotification, I have to call UIKeyboard.Notifications.ObserveWillShow, and manually wrap a function in an EventHandler:

UIKeyboard.Notifications.ObserveWillShow(EventHandler<_>(fun sender args -> 
    doSomething args))

When I would expect to be able to just do this:

UIKeyboard.WillShow.Add(doSomething)

To allow this, I added a static event to UIKeyboard:

module UIKeyboardNotifications =
    let WillShow = Event<_>()
    UIKeyboard.Notifications.ObserveWillShow(EventHandler<_>(fun sender args -> WillShow.Trigger(args)))

type UIKeyboard with
    static member WillShow = UIKeyboardNotifications.WillShow.Publish

But this should be part of MonoTouch.dll.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions