Fontinfo expand/collapse

S

Shawn Meyer

I added a fontinfo property to a custom control

public FontInfo TitleFont
{
get { return _title_font; }
set { _title_font = value; }
}

In the designer TitleFont it is not expandable like on all other controls
Font properties.
Instead it is just a blank text box that you can type text into.
How do I make it expandable to set the sub properties from the designer.

Thanks,
Shawn
 
V

Victor Garcia Aprea [MVP]

Hi Shawn,

Where/How is _title_font being instantiated? Also you should only offer a
get accesor for this property, there is no really a need for a set accesor.

I'm assuming you have an Style instance in your type for which you want to
expose its Font property. You could code the TitleFont property like this:
[C#]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[NotifyParentProperty(true)]
public FontInfo TitleFont {
get {return _style.Font;}
}

Assuming you have instantiated _style properly, this will show up properly
in the Properties window,

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
 
S

Shawn Meyer

That worked great. Thanks much.
Shawn

Victor Garcia Aprea said:
Hi Shawn,

Where/How is _title_font being instantiated? Also you should only offer a
get accesor for this property, there is no really a need for a set accesor.

I'm assuming you have an Style instance in your type for which you want to
expose its Font property. You could code the TitleFont property like this:
[C#]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[NotifyParentProperty(true)]
public FontInfo TitleFont {
get {return _style.Font;}
}

Assuming you have instantiated _style properly, this will show up properly
in the Properties window,

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup

Shawn Meyer said:
I added a fontinfo property to a custom control

public FontInfo TitleFont
{
get { return _title_font; }
set { _title_font = value; }
}

In the designer TitleFont it is not expandable like on all other controls
Font properties.
Instead it is just a blank text box that you can type text into.
How do I make it expandable to set the sub properties from the designer.

Thanks,
Shawn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,273
Latest member
DamonShoem

Latest Threads

Top