public DisposePage () { var popButton = new Button {Text = "Pop"}; popButton.Clicked += (sender, args) => PopAction (); var disposeLabel1 = new DisposeLabel {Text = "Label 1"}; var disposeLabel2 = new DisposeLabel {Text = "Label 2"}; var disposeLabel3 = new DisposeLabel {Text = "Label 3"}; var disposeLabel4 = new DisposeLabel {Text = "Label 4"}; var disposeLabel5 = new DisposeLabel {Text = "Label 5"}; EventHandler disposeHandler = (sender, args) => DisposedLabelCount++; disposeLabel1.RendererDisposed += disposeHandler; disposeLabel2.RendererDisposed += disposeHandler; disposeLabel3.RendererDisposed += disposeHandler; disposeLabel4.RendererDisposed += disposeHandler; disposeLabel5.RendererDisposed += disposeHandler; Content = new StackLayout { Children = { popButton, disposeLabel1, disposeLabel2, disposeLabel3, disposeLabel4, new StackLayout { Children = { disposeLabel5, } } } }; }
public DisposePage() { var popButton = new Button { Text = "Pop" }; popButton.Clicked += (sender, args) => PopAction(); var disposeLabel1 = new DisposeLabel { Text = "Label 1" }; var disposeLabel2 = new DisposeLabel { Text = "Label 2" }; var disposeLabel3 = new DisposeLabel { Text = "Label 3" }; var disposeLabel4 = new DisposeLabel { Text = "Label 4" }; var disposeLabel5 = new DisposeLabel { Text = "Label 5" }; EventHandler disposeHandler = (sender, args) => DisposedLabelCount++; disposeLabel1.RendererDisposed += disposeHandler; disposeLabel2.RendererDisposed += disposeHandler; disposeLabel3.RendererDisposed += disposeHandler; disposeLabel4.RendererDisposed += disposeHandler; disposeLabel5.RendererDisposed += disposeHandler; Content = new StackLayout { Children = { popButton, disposeLabel1, disposeLabel2, disposeLabel3, disposeLabel4, new StackLayout { Children = { disposeLabel5, } } } }; }