Bug 35715 - UIKeyCommand should have .ctor or Create method that takes an Action<UIKeyCommand> (and expose it as a Property)
Summary: UIKeyCommand should have .ctor or Create method that takes an Action<UIKeyCom...
Status: NEW
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll (show other bugs)
Version: XI 9.4 (iOS 9.2)
Hardware: PC Mac OS
: Low enhancement
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-11-09 19:52 UTC by Larry O'Brien
Modified: 2016-04-12 15:27 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Larry O'Brien 2015-11-09 19:52:43 UTC
UIKeyCommand's purpose is to fire an `Action<KeyCommand>`, which we currently allow via the Create method:

static hidebysig class MonoTouch.UIKit.UIKeyCommand Create(class MonoTouch.Foundation.NSString keyCommandInput, valuetype MonoTouch.UIKit.UIKeyModifierFlags modifierFlags, class MonoTouch.ObjCRuntime.Selector action)

This requires code like this:

        [Export("NewFileAccelerator:")]
        void NewFileAccelerator(UIKeyCommand cmd)
        {
           //etc...
        }

        public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();

            var actionSelector = new Selector("NewFileAccelerator:");
            accelerator = UIKeyCommand.Create((NSString) "N", UIKeyModifierFlags.Command, actionSelector);

            AddKeyCommand(accelerator);
        }

which would be improved if we could expose a .ctor or factory method that takes an `Action<UIKeyCommand>` rather a `Selector`.

Note You need to log in before you can comment on or make changes to this bug.