A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

35 lines
945 B

using System.Collections.Generic;
using Avalonia.Controls;
namespace Avalonia.Benchmarks
{
internal class ControlHierarchyCreator
{
public static List<Control> CreateChildren(List<Control> controls, Panel parent, int childCount, int innerCount, int iterations)
{
for (var i = 0; i < childCount; ++i)
{
var control = new StackPanel();
parent.Children.Add(control);
for (int j = 0; j < innerCount; ++j)
{
var child = new Button();
parent.Children.Add(child);
controls.Add(child);
}
if (iterations > 0)
{
CreateChildren(controls, control, childCount, innerCount, iterations - 1);
}
controls.Add(control);
}
return controls;
}
}
}