diff --git a/CHANGELOG.md b/CHANGELOG.md
index a4b4cdb..90d1cc0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -33,6 +33,7 @@ Improvements
- **Include the SpriteBatchContext in OnDrawn, OnElementDrawn and OnSelectedElementDrawn**
- Allow scrolling panels to set height based on children by setting TreatSizeAsMaximum
- Track element area update recursion count in UiMetrics
+- Made the Element.Children collection public
Fixes
- Fixed hidden scroll bars inhibiting scrolling on their parent panel
diff --git a/Demos/GameImpl.cs b/Demos/GameImpl.cs
index 45e0adf..526f2c1 100644
--- a/Demos/GameImpl.cs
+++ b/Demos/GameImpl.cs
@@ -60,7 +60,7 @@ namespace Demos {
this.activeDemo = null;
selection.IsHidden = false;
e.IsHidden = true;
- selection.Root.SelectElement(selection.GetChildren().First(c => c.CanBeSelected));
+ selection.Root.SelectElement(selection.Children.First(c => c.CanBeSelected));
},
IsHidden = true
});
diff --git a/Demos/UiDemo.cs b/Demos/UiDemo.cs
index 12ef1c5..e050dc8 100644
--- a/Demos/UiDemo.cs
+++ b/Demos/UiDemo.cs
@@ -254,9 +254,9 @@ namespace Demos {
this.root.AddChild(new VerticalSpace(3));
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, "The code for this demo contains some examples for how to query element data. This is the output of that:"));
- var children = this.root.GetChildren();
+ var children = this.root.Children;
var totalChildren = this.root.GetChildren(regardGrandchildren: true);
- this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, $"The root has {children.Count()} children, but there are {totalChildren.Count()} when regarding children's children"));
+ this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, $"The root has {children.Count} children, but there are {totalChildren.Count()} when regarding children's children"));
var textFields = this.root.GetChildren();
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, $"The root has {textFields.Count()} text fields"));
@@ -270,7 +270,7 @@ namespace Demos {
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, $"The root has {autoWidthChildren.Count()} auto-width children, {autoWidthButtons.Count()} of which are buttons"));
// select the first element for auto-navigation
- this.root.Root.SelectElement(this.root.GetChildren().First(c => c.CanBeSelected));
+ this.root.Root.SelectElement(this.root.Children.First(c => c.CanBeSelected));
}
// This method is used by the wobbling button (see above)
diff --git a/MLEM.Ui/Elements/Dropdown.cs b/MLEM.Ui/Elements/Dropdown.cs
index 1131494..6f2e7ac 100644
--- a/MLEM.Ui/Elements/Dropdown.cs
+++ b/MLEM.Ui/Elements/Dropdown.cs
@@ -143,7 +143,7 @@ namespace MLEM.Ui.Elements {
this.GetGamepadNextElement = (dir, usualNext) => {
// Force navigate down to our first child if we're open
if (this.IsOpen && dir == Direction2.Down)
- return this.Panel.GetChildren().FirstOrDefault(c => c.CanBeSelected) ?? usualNext;
+ return this.Panel.Children.FirstOrDefault(c => c.CanBeSelected) ?? usualNext;
return usualNext;
};
}
diff --git a/MLEM.Ui/Elements/Element.cs b/MLEM.Ui/Elements/Element.cs
index ba5aa81..31247f6 100644
--- a/MLEM.Ui/Elements/Element.cs
+++ b/MLEM.Ui/Elements/Element.cs
@@ -497,7 +497,7 @@ namespace MLEM.Ui.Elements {
/// A list of all of this element's direct children.
/// Use or to manipulate this list while calling all of the necessary callbacks.
///
- protected readonly IList Children;
+ public readonly IList Children;
///
/// A list of all of the instances that are currently playing.
/// You can modify this collection through and .