fix: SectionPanel tuntime ChildrenSoruce change

This commit is contained in:
2026-03-02 14:46:50 +03:00
parent 1039af0e80
commit d0a940c1f3
+10
View File
@@ -25,6 +25,8 @@ public class SectionPanel : Panel
return value; return value;
if (sectionPanel.Cyclic) if (sectionPanel.Cyclic)
return value; return value;
if (sectionPanel.Children.Count() == 0)
return 0;
return Math.Clamp(value, 0, sectionPanel.Children.Count() - 1); return Math.Clamp(value, 0, sectionPanel.Children.Count() - 1);
}); });
public int CurrentIndex public int CurrentIndex
@@ -119,6 +121,14 @@ public class SectionPanel : Panel
foreach (var control in controls) foreach (var control in controls)
panel.Children.Add(control); panel.Children.Add(control);
if (_initialized)
{
_childIndeces.Clear();
foreach (var (i, child) in Children.Enumerate())
_childIndeces.Add(child, i);
_initialized = true;
}
} }
panel.InvalidateArrange(); panel.InvalidateArrange();
}); });