forked from amkovkov/GranuSightSoftware2
fix: SectionPanel tuntime ChildrenSoruce change
This commit is contained in:
@@ -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();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user