ICSharpCode.WpfDesign.Designer.Services.CreateComponentTool.CreateItem C# (CSharp) Method

CreateItem() protected method

Is called to create the item used by the CreateComponentTool.
protected CreateItem ( DesignContext context ) : DesignItem
context DesignContext
return DesignItem
        protected virtual DesignItem CreateItem(DesignContext context)
        {
            object newInstance = context.Services.ExtensionManager.CreateInstanceWithCustomInstanceFactory(componentType, null);
            DesignItem item = context.Services.Component.RegisterComponentForDesigner(newInstance);
            changeGroup = item.OpenGroup("Drop Control");
            context.Services.Component.SetDefaultPropertyValues(item);
            context.Services.ExtensionManager.ApplyDefaultInitializers(item);
            return item;
        }

Usage Example

        public static bool AddItemWithDefaultSize(DesignItem container, Type createdItem, Size size)
        {
            CreateComponentTool cct = new CreateComponentTool(createdItem);

            return(AddItemWithCustomSize(container, cct.CreateItem(container.Context), new Point(0, 0), size));
        }
All Usage Examples Of ICSharpCode.WpfDesign.Designer.Services.CreateComponentTool::CreateItem