internal static bool AddItemWithCustomSize(DesignItem container, DesignItem createdItem, Point position, Size size)
{
PlacementOperation operation = PlacementOperation.TryStartInsertNewComponents(
container,
new DesignItem[] { createdItem },
new Rect[] { new Rect(position, size).Round() },
PlacementType.AddItem
);
if (operation != null) {
container.Services.Selection.SetSelectedComponents(new DesignItem[] { createdItem });
operation.Commit();
return true;
} else {
return false;
}
}