in Blog-ModernizationStory/DynamicWindowsForms/FormDynamic.cs [115:146]
private void AddControl(string text, bool isXaml)
{
if (!isXamlIslandsSupported)
{
isXaml = false;
}
var controlTypeHelper = new ControlTypeHelper();
ControlEnum? controlType = controlTypeHelper.GetControlEnum(text,isXaml);
if (controlType == null)
{
return;
}
//-- factory pattern
ControlFactory factory = (isXaml) ?
(ControlFactory)(new ControlFactoryXaml()) :
(ControlFactory)(new ControlFactoryNet());
var control = factory.GetControl(controlType.Value);
if (control == null)
{
return;
}
flowLayoutPanel1.Controls.Add(control);
flowLayoutPanel1.ScrollControlIntoView(control);
}