Style Builder for Custom Web Control

Discussion in 'ASP .Net Web Controls' started by Brendan Green, Aug 29, 2005.

  1. 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.
    Brendan Green, Aug 29, 2005
    #1
    1. Advertising

  2. 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:




    Brendan Green wrote:
    > *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
    -----------------------------------------------------------------------
    Posted via http://www.mcse.m
    -----------------------------------------------------------------------
    View this thread: http://www.mcse.ms/message1821251.htm
    Sandeep Chanda, Apr 1, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. johndow

    Style Builder web interface

    johndow, Sep 9, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    325
    johndow
    Sep 9, 2004
  2. Phlip
    Replies:
    5
    Views:
    550
    Stefan Behnel
    Jan 13, 2010
  3. Matt Sokol
    Replies:
    2
    Views:
    366
    Theo Tillotson
    Aug 7, 2003
  4. Ken Varn
    Replies:
    0
    Views:
    429
    Ken Varn
    Apr 26, 2004
  5. Ryan Taylor

    Building a custom server control - Property Builder

    Ryan Taylor, Feb 8, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    117
    Ryan Taylor
    Feb 8, 2005
Loading...

Share This Page