Hello,
Please report this to Microsoft and note that many features have not yet been implemented as Windows Forms is still in preview mode.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
ControlDesigner class is used for designer related scenario in Windows forms. It works good in .NETFramwork but not in .NetCore and .NET6.
.NET5 :
.NET Framework:
Please fix this ASAP or provide a solution.
Code for CustomControl used are below.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Forms.Design;
namespace Winforms_SmartTag
{
[Designer(typeof(CustomControlDesigner), typeof(System.ComponentModel.Design.IDesigner))]
public class CustomControl : Button
{
}
public class CustomControlDesigner : ControlDesigner
{
System.ComponentModel.Design.DesignerActionListCollection actionLists;
public override DesignerActionListCollection ActionLists
{
get
{
if (null == actionLists)
{
actionLists = new System.ComponentModel.Design.DesignerActionListCollection();
actionLists.Add(
new CustomControlDesignerActionList(this.Component));
}
return actionLists;
}
}
}
public class CustomControlDesignerActionList : DesignerActionList
{
CustomControl Control;
public CustomControlDesignerActionList(IComponent component)
: base(component)
{
Control = component as CustomControl;
}
DesignerActionItemCollection actonListItems = null;
public override DesignerActionItemCollection GetSortedActionItems()
{
actonListItems = new DesignerActionItemCollection();
actonListItems.Add(new DesignerActionHeaderItem("Test1"));
actonListItems.Add(new DesignerActionHeaderItem("Test2"));
return actonListItems;
}
public string Name
{
get
{
string name = string.Empty;
if (this.Control != null)
{
CustomControl control = this.Control as CustomControl;
name = control.Name;
}
return name;
}
}
}
}
Hello,
Please report this to Microsoft and note that many features have not yet been implemented as Windows Forms is still in preview mode.