diff options
author | Jose Medrano <josmed@microsoft.com> | 2022-02-16 20:26:59 +0300 |
---|---|---|
committer | vs-mobiletools-engineering-service2 <valco@microsoft.com> | 2022-03-01 18:01:15 +0300 |
commit | 0cd914209735725f17a755fba1907d95acce7005 (patch) | |
tree | 1fc974571730cba3ed757a7a04a8e374d00029ae | |
parent | 685039bab71ed5c40a128e9cf67f898e83e379c3 (diff) |
Makes first and last focusable view in BasePathEditorControl use ProxyRowResponder
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/BasePathEditorControl.cs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/BasePathEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BasePathEditorControl.cs index 923281e..9164f8d 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/BasePathEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/BasePathEditorControl.cs @@ -23,11 +23,35 @@ namespace Xamarin.PropertyEditing.Mac private readonly NSObject[] objects;
public override NSObject[] AccessibilityChildren { get => this.objects; }
+ private readonly TextNextResponderDelegate textNextResponderDelegate; + + class BasePathEditordDelegate : TextNextResponderDelegate + { + WeakReference<BasePathEditorControl<T>> weakView; + + public BasePathEditordDelegate (BasePathEditorControl<T> basePathEditorControl) + { + weakView = new WeakReference<BasePathEditorControl<T>>(basePathEditorControl); + } + + public override void Changed (NSNotification notification) + { + if (this.weakView.TryGetTarget(out BasePathEditorControl<T> t)) { + t.StoreCurrentValue (); + } + } + } + protected BasePathEditorControl (IHostResourceProvider hostResource)
: base (hostResource)
{
this.currentTextField = new TextFieldSmallButtonContainer ();
- this.currentTextField.Changed += CurrentTextField_Changed; + + this.textNextResponderDelegate = new BasePathEditordDelegate (this) + { + ResponderProxy = new ProxyRowResponder(this, ProxyRowType.SingleView) + }; + this.currentTextField.Delegate = this.textNextResponderDelegate; AddSubview (this.currentTextField); #region Reveal handler
|