diff options
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs')
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs index 90ca577..7e8b6bc 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs @@ -142,6 +142,8 @@ namespace Xamarin.PropertyEditing.Mac }); } + FocusClickedRow (); + var menuOrigin = this.Superview.ConvertPointToView (new CGPoint (Frame.Location.X - 1, Frame.Location.Y + Frame.Size.Height + 4), null); var popupMenuEvent = NSEvent.MouseEvent (NSEventType.LeftMouseDown, menuOrigin, (NSEventModifierMask)0x100, 0, this.Window.WindowNumber, this.Window.GraphicsContext, 0, 1, 1); @@ -149,6 +151,25 @@ namespace Xamarin.PropertyEditing.Mac NSMenu.PopUpContextMenu (popUpContextMenu, popupMenuEvent, this); } + private void FocusClickedRow () + { + if (Superview != null) { + MakeFocusableKeyViewFirstResponder (Superview.Subviews); + } + } + + private void MakeFocusableKeyViewFirstResponder (NSView[] subViews) + { + foreach (NSView item in subViews) { + if (item.CanBecomeKeyView) { + Window.MakeFirstResponder (item); + break; + } else { + MakeFocusableKeyViewFirstResponder (item.Subviews); + } + } + } + private void ToggleFocusImage (bool focused = false) { if (this.viewModel != null) { |