ExpandableObjectConverter (Almost Working)


R

Ron Vecchi

I have a custom control inheriting from System.Web.UI.Control. I
implemented the ExpandableObjectConverter and everything is working fine in
the designer. The proerty is expanded and I can select the child properties
and the change is displayed to the parent.

When my custom control renders, an html atribute is created from the values
of both child properties of the parent property. ex (salign="LB").
How can I get this to show up in my Html View when I set the child
properties in design view? Right now nothing is displayed in the controls
html view when I change the properties in design. Also when I build my
project my newly set child properties are rcleared from the poperties
window.


////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////
//////////////////// Custom control property
///////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////
[Browsable(true),
Description("Gets or Sets the Flash Horizontal and Vertical Alignment
Parameters."),
Category("Alignment"),
PersistenceMode(PersistenceMode.InnerProperty),
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public FlashMovieAlignment FlashAlignment {
get {return this._mflashalign;}
set {this._mflashalign = value;}
}

////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////
//////////////////// Class that is Expandable in design view of custom
control ////
////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////
[TypeConverter(typeof(ExpandableObjectConverter))]
public class FlashMovieAlignment {

private FlashHorizontalAlignment _halign;
private FlashVerticalAlignment _valign;



[DefaultValue(typeof(DHelixWebControls.UI.FlashHorizontalAlignment),"Center"
),
NotifyParentProperty(true),
RefreshProperties(RefreshProperties.Repaint)]
public FlashHorizontalAlignment HorizontalAlign {
get {return this._halign;}
set {this._halign = value;}
}


[DefaultValue(typeof(DHelixWebControls.UI.FlashVerticalAlignment),"Center"),
NotifyParentProperty(true),
RefreshProperties(RefreshProperties.Repaint)]
public FlashVerticalAlignment VerticalAlign {
get {return this._valign;}
set {this._valign = value;}
}


public FlashMovieAlignment() {

this.Initialize(FlashHorizontalAlignment.Center,FlashVerticalAlignment.Cente
r);
}
}


Thanks
 
Ad

Advertisements

M

MSFT

Hi Ron,

You may take a look at following article to see if it will help:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconcontrolparsingcustomattributescontrolbuilders.asp

Especailly, you may try to create a custom ControlBuilder class to see if
it will help. For more information on web controls design time support, you
may refer to:

http://longhorn.msdn.microsoft.com/lhsdk/ndp/cpconenhancingdesign-timesuppor
t.aspx

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

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

Top