Style Builder for Custom Web Control

B

Brendan Green

Hi all,
I've been searching around, couldn't find an answer, so decided to post
here. Hopefully someone can help me out!

First of all, I'm using the Beta 2 of Visual Studio 2005.

I've written a custom web control, and it has a property TitleStyle, which I
want to take style information (e.g. "padding-left: 5px;").

Currently, this property is a simple string, and all works well. The
outputted HTML is properly formed.

However, I would like to enhance this, and give the user access to the Style
Builder.

The code that I have at the moment looks like this:

private Style m_titleStyle;

[Bindable(true)]
[Editor(typeof(System.Web.UI.Design.WebControls.StyleCollectionEditor),
typeof(System.Web.UI.Design.WebControls.StyleCollectionEditor))]
public Style TitleStyle
{
// getter and setter
}

Now, when ellipsis in the designer Properties, I don't get the Style Builder
dialog, but the Object Collection Editor.

So, either I'm completely wrong, or almost there!

Does anyone know how to set the editor correctly, so that in the designer I
can display the Style Builder?

Thanks in advance,
Brendan.
 
S

Sandeep Chanda

Hi Brendan....

the editor attribute needs a bit of modification. Try this and let m
know if it worked..

Editor(typeof(System.Web.UI.Design.WebControls.StyleCollectionEditor),
typeof(System.Drawing.Design.UITypeEditor))]

You can reach me at:

(e-mail address removed)


Brendan said:
*Hi all,
I've been searching around, couldn't find an answer, so decided t
post
here. Hopefully someone can help me out!

First of all, I'm using the Beta 2 of Visual Studio 2005.

I've written a custom web control, and it has a property TitleStyle
which I
want to take style information (e.g. "padding-left: 5px;").

Currently, this property is a simple string, and all works well.
The
outputted HTML is properly formed.

However, I would like to enhance this, and give the user access t
the Style
Builder.

The code that I have at the moment looks like this:

private Style m_titleStyle;

[Bindable(true)]
[Editor(typeof(System.Web.UI.Design.WebControls.StyleCollectionEditor),
typeof(System.Web.UI.Design.WebControls.StyleCollectionEditor))]
public Style TitleStyle
{
// getter and setter
}

Now, when ellipsis in the designer Properties, I don't get the Styl
Builder
dialog, but the Object Collection Editor.

So, either I'm completely wrong, or almost there!

Does anyone know how to set the editor correctly, so that in th
designer I
can display the Style Builder?

Thanks in advance,
Brendan.


-
Sandeep Chand
 

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,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top