Winforms 无法在设计时设置 属性-Values
Winforms can't set Property-Values at design-time
我正在尝试基于 DevExpress Grid (v.14.2) 创建自己的 GridControl。这似乎工作正常,但我的设置对象在设计器中不可编辑。
到目前为止,这是我的网格:
[ToolboxItem(true)]
[DXToolboxItem(true)]
public class MyGrid : GridControl
{
private Settings _settings;
public MyGrid()
{
_settings= new Settings();
}
[Category("My Category")]
[Description("My Description")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public Settings Settings
{
get { return _settings; }
set { _settings = value; }
}
}
这是我的设置-Class:
[EditorBrowsable(EditorBrowsableState.Always)]
public class Einstellungen
{
[Category("My Category")]
[Description("My Description")]
public bool CanGroup { get; set; }
[Category("My Category")]
[Description("My Description")]
public bool IsEditable { get; set; }
}
我是否缺少任何属性?在 msdn 上搜索但他们也只是推荐使用的属性...
在设计器中我只能看到:
设置 | MyNamespace.Settings 但无法编辑 bool 属性。
也许这行得通...
[TypeConverter(typeof(ExpandableObjectConverter))]
[EditorBrowsable(EditorBrowsableState.Always)]
public class Einstellungen
{
[Category("My Category")]
[Description("My Description")]
[Browsable(true)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public bool CanGroup { get; set; }
[Category("My Category")]
[Description("My Description")]
[Browsable(true)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public bool IsEditable { get; set; }
}
我正在尝试基于 DevExpress Grid (v.14.2) 创建自己的 GridControl。这似乎工作正常,但我的设置对象在设计器中不可编辑。
到目前为止,这是我的网格:
[ToolboxItem(true)]
[DXToolboxItem(true)]
public class MyGrid : GridControl
{
private Settings _settings;
public MyGrid()
{
_settings= new Settings();
}
[Category("My Category")]
[Description("My Description")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public Settings Settings
{
get { return _settings; }
set { _settings = value; }
}
}
这是我的设置-Class:
[EditorBrowsable(EditorBrowsableState.Always)]
public class Einstellungen
{
[Category("My Category")]
[Description("My Description")]
public bool CanGroup { get; set; }
[Category("My Category")]
[Description("My Description")]
public bool IsEditable { get; set; }
}
我是否缺少任何属性?在 msdn 上搜索但他们也只是推荐使用的属性...
在设计器中我只能看到: 设置 | MyNamespace.Settings 但无法编辑 bool 属性。
也许这行得通...
[TypeConverter(typeof(ExpandableObjectConverter))]
[EditorBrowsable(EditorBrowsableState.Always)]
public class Einstellungen
{
[Category("My Category")]
[Description("My Description")]
[Browsable(true)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public bool CanGroup { get; set; }
[Category("My Category")]
[Description("My Description")]
[Browsable(true)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public bool IsEditable { get; set; }
}