From 0ad17fc40c6502a8e689ecfb4a242e62a048a769 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 12 Sep 2019 11:52:47 +0200 Subject: [PATCH] added a method to remove all children from an element --- MLEM.Ui/Elements/Element.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MLEM.Ui/Elements/Element.cs b/MLEM.Ui/Elements/Element.cs index ca1f6ac..1870185 100644 --- a/MLEM.Ui/Elements/Element.cs +++ b/MLEM.Ui/Elements/Element.cs @@ -178,6 +178,12 @@ namespace MLEM.Ui.Elements { this.SetAreaDirty(); } + public void RemoveChildren() { + for (var i = this.Children.Count - 1; i >= 0; i--) { + this.RemoveChild(this.Children[i]); + } + } + public void SetAreaDirty() { this.areaDirty = true; if (this.Anchor >= Anchor.AutoLeft && this.Parent != null)