From 9146d7f2bab1ecffa60c04b42e1e021b3fd43a81 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 7 Feb 2021 18:30:56 +0100 Subject: [PATCH] disallow removing the scroll bar from a panel --- MLEM.Ui/Elements/Panel.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MLEM.Ui/Elements/Panel.cs b/MLEM.Ui/Elements/Panel.cs index 4abaabd..9e60468 100644 --- a/MLEM.Ui/Elements/Panel.cs +++ b/MLEM.Ui/Elements/Panel.cs @@ -108,8 +108,11 @@ namespace MLEM.Ui.Elements { /// public override void ForceUpdateSortedChildren() { base.ForceUpdateSortedChildren(); - if (this.scrollOverflow) + if (this.scrollOverflow) { + if (this.ScrollBar.Parent != this) + throw new NotSupportedException("A panel that scrolls overflow cannot have its scroll bar removed from its list of children"); this.relevantChildrenDirty = true; + } } ///