在Visual Studio 2008中为用户控件启用设计时支持

时间:2009-02-08 10:22:26

标签: c# visual-studio-2008 devexpress

我创建了usercontrol GridEx:UserControl。 在那个控件上我推出了GridControl(DevExpress数据网格控件)。 我创建了Property 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...

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

解决方案可以在这里建立:

http://www.devexpress.com/kb=A577