From 297bf42bd6bc1767010a08c173b63bc7c30c8886 Mon Sep 17 00:00:00 2001 From: BDisp Date: Sun, 6 Jun 2021 20:52:45 +0100 Subject: [PATCH] Fixes InvalidOperationException from throwing when removing the label. --- UICatalog/Scenarios/LabelsAsButtons.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/UICatalog/Scenarios/LabelsAsButtons.cs b/UICatalog/Scenarios/LabelsAsButtons.cs index 8eac1985f..0388b7b56 100644 --- a/UICatalog/Scenarios/LabelsAsButtons.cs +++ b/UICatalog/Scenarios/LabelsAsButtons.cs @@ -117,8 +117,14 @@ namespace UICatalog { CanFocus = true, }; Win.Add (removeLabel); - // This in intresting test case because `moveBtn` and below are laid out relative to this one! - removeLabel.Clicked += () => Win.Remove (removeLabel); + // This in interesting test case because `moveBtn` and below are laid out relative to this one! + removeLabel.Clicked += () => { + // Now this throw a InvalidOperationException on the TopologicalSort method as is expected. + //Win.Remove (removeLabel); + + removeLabel.Visible = false; + Win.SetNeedsDisplay (); + }; var computedFrame = new FrameView ("Computed Layout") { X = 0,