Using a class as a custom property

  • Thread starter Thread starter Torben Laursen
  • Start date Start date
T

Torben Laursen

I am overwriting a textbox to add some extra properties.
That all work fine.
However when I put the extra properties into a class and make that class a
property of my own textbox it is shown with a gray color text in the
property window. What is shown is the name of the textbox with namespaces.
Also there is no "+" sign so I can expand it to view and change the
properties of that class.

I must be missing something can anyone tell me what?

Torben
 
Hi,

[TypeConverter(typeof(ExpandableObjectConverter))]
class CustomProps
{
...
}

class YourTextBox : TextBox
{
public CustomProps Props
{
get { return props; }
}

private readonly CustomProps props =
new CustomProps();
}

:)
 

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

Back
Top