diff options
Diffstat (limited to 'Xamarin.PropertyEditing.Mac')
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs | 32 | ||||
-rw-r--r-- | Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs | 6 |
2 files changed, 15 insertions, 23 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs index 5b33084..7106b79 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs @@ -20,7 +20,6 @@ namespace Xamarin.PropertyEditing.Mac public abstract NSView FirstKeyView { get; } public abstract NSView LastKeyView { get; } - public nint TableRow { get; set; } = -1; public NSTableView TableView { get; set; } public const int DefaultControlHeight = 22; @@ -70,26 +69,23 @@ namespace Xamarin.PropertyEditing.Mac public void UpdateKeyViews () { - if (TableRow < 0) + nint row = TableView.RowForView (this); + if (row <= 0) return; + NSView view; PropertyEditorControl ctrl = null; - - var tr = TableRow; - if (tr > 0) { - NSView view; - do { - tr--; - view = TableView.GetView (0, tr, false); - ctrl = (view as EditorContainer)?.EditorView?.NativeView as PropertyEditorControl; - } while (tr > 0 && ctrl == null); - - if (ctrl != null) { - ctrl.LastKeyView.NextKeyView = FirstKeyView; - ctrl.UpdateKeyViews (); - } else if (tr == 0 && view is PanelHeaderEditorControl header) { - header.SetNextKeyView (FirstKeyView); - } + do { + row--; + view = TableView.GetView (0, row, makeIfNecessary: false); + ctrl = (view as EditorContainer)?.EditorView?.NativeView as PropertyEditorControl; + } while (row > 0 && ctrl == null); + + if (ctrl != null) { + ctrl.LastKeyView.NextKeyView = FirstKeyView; + ctrl.UpdateKeyViews (); + } else if (row == 0 && view is PanelHeaderEditorControl header) { + header.SetNextKeyView (FirstKeyView); } } diff --git a/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs b/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs index f37a8de..e25efbb 100644 --- a/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs +++ b/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs @@ -90,15 +90,11 @@ namespace Xamarin.PropertyEditing.Mac } if (editor != null) { - nint index = outlineView.RowForItem (item); - if (editor.NativeView is PropertyEditorControl pec) { - pec.TableRow = index; - } - editor.ViewModel = evm; // Force a row update due to new height, but only when we are non-default if (editor.IsDynamicallySized) { + nint index = outlineView.RowForItem (item); outlineView.NoteHeightOfRowsWithIndexesChanged (new NSIndexSet (index)); } } else if (editorOrContainer is PanelHeaderEditorControl header) { |