all groups > dotnet windows forms designtime > july 2006 >
You're in the

dotnet windows forms designtime

group:

Dock and TopLevel properties not appearing in the designer.


Dock and TopLevel properties not appearing in the designer. Kaine
7/7/2006 4:31:01 AM
dotnet windows forms designtime:
We have found that the Dock and TopLevel properties do not appear in the .NET
2005 C# forms designer so we added the code below to our base forms, but
still the properties would not appear for our derived forms. Once we changed
the names of the properties and removed the override keywords the properties
appeared under new names and worked as expected, but we would like them to
work with their proper names. Is there something we are missing from our
attributes that needs to be added?

[Description("Gets/sets the docking style for the form."),
Category("CasinoLink"),
Bindable(BindableSupport.No), DesignOnly(false),
DefaultValue(DockStyle.Fill)]
public override DockStyle Dock
{
get
{
return base.Dock;
}
set
{
base.Dock = value;
}
}

[Description("Gets/sets the indicator that allows the form to be
displayed as a top level form."), Category("CasinoLink"),
Bindable(BindableSupport.No), DesignOnly(false), DefaultValue(false)]
public new bool TopLevel
{
get { return (base.TopLevel); }
set { base.TopLevel = value; }
Re: Dock and TopLevel properties not appearing in the designer. Dave Sexton
7/7/2006 9:35:53 PM
Hi Kaine,

[Browsable(true)]
public override DockStyle Dock {}

HTH

[quoted text, click to view]

Re: Dock and TopLevel properties not appearing in the designer. Kaine
8/13/2006 11:04:01 AM
Sorry for the lateness in the reply. We tried this originally and found that
the property still wouldn't appear in the designer. The only way we managed
to successfully do this was to use a wrapper property which we called
DockingStyle.

[quoted text, click to view]
Re: Dock and TopLevel properties not appearing in the designer. Dave Sexton
8/13/2006 3:42:15 PM
Hi Kaine,

It's a strange thing. I tried using the "new" keyword as well but that didn't do any good either.

However, the DisplayNameAttribute worked fine for me, but it requires a new property. Here's an example:

[DisplayName("Dock")]
public virtual DockStyle DockStyle
{
get { return base.Dock; }
set { base.Dock = value; }
}

// seal the Dock property so that it cannot be overridden by a derived class
public sealed override DockStyle Dock
{
get { return base.Dock; }
set { base.Dock = value; }
}

--
Dave Sexton

[quoted text, click to view]

AddThis Social Bookmark Button