From 0c992ff12e1398ec307d2309769575f10ac82799 Mon Sep 17 00:00:00 2001 From: Eric Maupin Date: Thu, 7 Nov 2019 14:32:09 -0500 Subject: [mac] Use more reliable row removed notice This method seems far more reliable for noticing when rows are removed so we can use it instead of changing to null superview (which sometimes it doesn't do). --- Xamarin.PropertyEditing.Mac/Controls/EditorContainer.cs | 8 -------- Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs | 7 +++++++ 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'Xamarin.PropertyEditing.Mac') diff --git a/Xamarin.PropertyEditing.Mac/Controls/EditorContainer.cs b/Xamarin.PropertyEditing.Mac/Controls/EditorContainer.cs index c22e438..2fee93f 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/EditorContainer.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/EditorContainer.cs @@ -55,14 +55,6 @@ namespace Xamarin.PropertyEditing.Mac } } - public override void ViewWillMoveToSuperview (NSView newSuperview) - { - if (newSuperview == null) - ViewModel = null; - - base.ViewWillMoveToSuperview (newSuperview); - } - #if DEBUG // Currently only used to highlight which controls haven't been implemented public NSColor LabelTextColor { set { LabelControl.TextColor = value; } diff --git a/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs b/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs index 49f2665..a322768 100644 --- a/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs +++ b/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs @@ -184,6 +184,13 @@ namespace Xamarin.PropertyEditing.Mac } } + public override void DidRemoveRowView (NSOutlineView outlineView, NSTableRowView rowView, nint row) + { + if (rowView.Subviews[0] is EditorContainer ec) { + ec.ViewModel = null; + } + } + public override nfloat GetRowHeight (NSOutlineView outlineView, NSObject item) { EditorViewModel vm; -- cgit v1.2.3