C# 在VisualStudio 2008中为用户控制启用设计时支持

C# 在VisualStudio 2008中为用户控制启用设计时支持,c#,visual-studio-2008,devexpress,C#,Visual Studio 2008,Devexpress,我已经创建了usercontrolgridex:usercontrol。 在那个控件上,我放置了GridControl-DevExpress-datagrid控件。 我已经创建了属性DataGrid,它返回先前添加的内部DataGrid控件 如何支持DataGrid的设计? 我试着把 [Designer("DevExpress.XtraGrid.Design.GridControlDesigner, DevExpress.XtraGrid.v8.2.Design", typeof(IDe

我已经创建了usercontrolgridex:usercontrol。 在那个控件上,我放置了GridControl-DevExpress-datagrid控件。 我已经创建了属性DataGrid,它返回先前添加的内部DataGrid控件 如何支持DataGrid的设计? 我试着把

[Designer("DevExpress.XtraGrid.Design.GridControlDesigner,
    DevExpress.XtraGrid.v8.2.Design", typeof(IDesigner))] 
但我得到了这个错误: 未能创建组件“DataGridControl”。 错误消息如下:

System.NullReferenceException: Object reference not set to an instance of an object.
  at DevExpress.XtraGrid.Design.GridControlDesigner.Initialize(IComponent component)
  at System.ComponentModel.Design.DesignerHost.AddToContainerPostProcess(IComponent component, String name, IContainer containerToAddTo)
  at System.ComponentModel.Design.DesignerHost.Add(IComponent component, String name)
  at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design. IDesignerHost.CreateComponent(Type componentType, String name)
   at System.ComponentModel.Design.DesignerHost.System.ComponentModel. Design.IDesignerHost.CreateComponent(Type componentType)
   at System.Drawing.Design.ToolboxItem.CreateComponentsCore(IDesignerHost host)
   at System.Drawing.Design.ToolboxItem.CreateComponentsCore(IDesignerHost host, IDictionary defaultValues)
   at System.Drawing.Design.ToolboxItem.CreateComponents(IDesignerHost host, IDictionary defaultValues)
   at System.Windows.Forms.Design.OleDragDropHandler.Cre...

尝试从DevExpress网格控件而不是“UserControl”类派生用户控件

可以在这里找到解决方案:


是的,我可以做到这一点,但这是可行的,但想法是让用户控制,我可以把一些额外的控制,如标签,我可以显示额外的细节,在网格行计数行,错误,如果有的话等。。谢谢你的回复和时间。