diff options
author | Jose Medrano <josmed@microsoft.com> | 2022-02-16 20:33:35 +0300 |
---|---|---|
committer | vs-mobiletools-engineering-service2 <valco@microsoft.com> | 2022-03-01 18:01:15 +0300 |
commit | 0f046f5754d82963363a64fcf4394835d52c01b3 (patch) | |
tree | 66063caceab0199f247abd845a5ac56b6285a0d0 | |
parent | 7f0a7271fac6f78de8ec7d4d2c945f908759dbc3 (diff) |
Makes EntryPropertyEditor use ProxyRowResponder
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/EntryPropertyEditor.cs | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/EntryPropertyEditor.cs b/Xamarin.PropertyEditing.Mac/Controls/EntryPropertyEditor.cs index f1d92ac..230c42d 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/EntryPropertyEditor.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/EntryPropertyEditor.cs @@ -2,9 +2,34 @@ using System; using AppKit; using Foundation; using Xamarin.PropertyEditing.ViewModels; +using ObjCRuntime; namespace Xamarin.PropertyEditing.Mac { + class TextNextResponderDelegate : NSTextFieldDelegate + { + public ProxyRowResponder ResponderProxy { get; set; } + + public override bool DoCommandBySelector (NSControl control, NSTextView textView, Selector commandSelector) + { + switch (commandSelector.Name) { + case "insertTab:": + if (ResponderProxy?.NextResponder () ?? false) + { + return true; + } + break; + case "insertBacktab:": + if (ResponderProxy?.PreviousResponder () ?? false) + { + return true; + } + break; + } + return false; + } + } + internal abstract class EntryPropertyEditor<T> : PropertyEditorControl<PropertyViewModel<T>> { @@ -61,7 +86,11 @@ namespace Xamarin.PropertyEditing.Mac protected virtual EntryPropertyEditorDelegate<T> CreateDelegate (PropertyViewModel<T> viewModel) { - return new EntryPropertyEditorDelegate<T> (viewModel); + var propertyEditorDelegate = new EntryPropertyEditorDelegate<T> (viewModel) + { + ResponderProxy = new ProxyRowResponder (this, ProxyRowType.SingleView) + }; + return propertyEditorDelegate; } protected virtual string GetValue (T value) @@ -71,7 +100,7 @@ namespace Xamarin.PropertyEditing.Mac } internal class EntryPropertyEditorDelegate<T> - : NSTextFieldDelegate + : TextNextResponderDelegate { public EntryPropertyEditorDelegate (PropertyViewModel<T> viewModel) { |