Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Anybody written a TypeConverter for a custom Style class?

Reply
Thread Tools

Anybody written a TypeConverter for a custom Style class?

 
 
Sky
Guest
Posts: n/a
 
      07-11-2004
Hello (again!):

Been working all weekend on trying to get a grip on what happens under the
hood with WebControl.ControlStyle property versus WebControl.Style array...
And think I am getting somewhere...except for a couple more hitches to work
out. (Famous last words, no?)

What I am trying to do is work with a custom Style class that has Margin,
Padding, Text-Align, etc...

That part has correctly compiled, and I was able to wire it into a custom
control by adding to the control:

protected override Style CreateControlStyle() {

return (XActStyle) new XActStyle(ViewState);

}


To expose it in the IDE's property panel, I did:
[TypeConverter(typeof(ExpandableObjectConverter))]

public new XActStyle ControlStyle {get {return
(XActStyle)base.ControlStyle;}} //base.ControlStyle;


Works great: finally am starting to feel that it is looking more like what I
want in the IDE, where the CSS values are not all over the Property Panel
(ForeColor, etc) but grouped together under a Typed Style expandable class.

Now...The problem is that when I put values into this via the IDE, they are
not serialized/persisted to the HTML behind the control...
I suspect that it is that I need a TypeConverter for this.

Q: Could someone tell me if that guess is right/wrong before I spend hours
and hours looking up how to make a TypeConverter for such a complex
structure (ie: is there a base TypeConverter that I can build onto rather
than trying to figure out by what magic MS was able to combine BorderStyle
BorderColor, etc. with Style["Border"], etc....

Q: If someone has already built a TypeConverter that I can refer to to get a
leg up, could you post it/guide me to it?

Q:When I get it to work.....with a little help from someone ... I assume
that it will still not be addressible via HTML attribute tags -- unless I
expose all these properties directly (ie TextAlign {get{return
ControlStyle.TextAlign;....}} just as MS did -- which would bring me right
back to where I was trying to get away from (Style/Position properties as
base properties of the control, rather than neatly tucked away as sub
properties of ControlStyle accessible only via an
ExpandableObjectConverter... So my question is, would there be any way
that someone can think of that I can TypeConvert the Style attribute to
populate this ControlStyle, and viceversa?
Q: Failing that being possible/feasible... would the properties be
accessible via Html by the "-" Syntax -- ie something like <MyControl
ControlStyle-TextAlign="right" ControlStyle-BorderStyle='dashed'> Obviously
this is not at all what I want either -- but I ask for about this for
...ugh...'academic?' reasons...



Again, thanks so much for all the help
Sky


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CAS prevents call to ConvertTo used by custom TypeConverter Jim ASP .Net Building Controls 4 10-25-2005 08:42 AM
Help! Problems with custom TypeConverter and Persistence... Sky Sigal ASP .Net 1 07-14-2004 01:02 AM
Help! custom TypeConverter/Persistence problems... Sky Sigal ASP .Net Web Controls 0 07-13-2004 10:54 PM
Re: Can a usercontrol written in C# be used in Web Forms that is written in VB.Net? Steve C. Orr, MCSD ASP .Net 1 08-24-2003 12:06 AM
make Serializable or create custom TypeConverter ? Christian ASP .Net 1 07-18-2003 12:42 PM



Advertisments