I have a control with an Ellipse
inside and I insert this control to WrapPanel
dynamically with foreach. Does anyone know how can I separate some Ellipse
from the others with Break or Newline:
foreach (var system in provider.Systems)
{
foreach (var fx in system.Fxes)
{
panel1.Children.Add(TrunkControl());
}
panel1.Children.Add(new SeperatorControl());
}
I want to add a new line or break after inner foreach. I just don't know what my SeperatorControl
should be.
You could add all your Ellipse to another StackPanel
then add that to your main StackPanel
so panel1 will be set to Vertical and you will add new StackPanels with all the Ellipse , there is no such thing as a new line in a stack panel.
foreach (var system in provider.Systems)
{
var stackpanel = new StackPanel { Orientation = Orientation.Horizontal };
foreach (var fx in system.Fxes)
{
stackpanel.Children.Add(TrunkControl());
}
panel1.Children.Add(stackpanel);
}
Result: