TypeConverters

M

MLibby

I have web custom control that exposes 3 XML properties ACXMLFile,
ACXMLString, and ACXMLDocument that I need to convert to one property,
ACXMLSource. ACXMLFile and ACXMLString are both design time properties while
ACXMLDocument is only a runtime property. How can I combine these all into
one property?

[

Bindable(true),

Category("ACXML"),

DefaultValue(""),

Description("Path to the XML file containing the content source
structure."),

]

public virtual string ACXMLFile

{

get

{

string s = (string)ViewState["ACXMLFile"];

return ((s == null) ? String.Empty : s);

}

set

{

ViewState["ACXMLFile"] = value;

}

}



[

Bindable(true),

Category("Cache Content ACDefaultUrl"),

DefaultValue(""),

Browsable(false),

Description("XML string containing the content source
structure."),

]

public virtual string ACXMLString

{

get

{

string s = (string)ViewState["ACXMLString"];

return ((s == null) ? String.Empty : s);

}

set

{

ViewState["ACXMLString"] = value;

}

}



[

Browsable(false),

Description("XML document containing the content source
structure."),

]

public virtual XmlDocument ACXMLDocument

{

get

{

string s = ACXMLSourceConvert;

if (s != null)

{

XmlDocument xd = new XmlDocument();

xd.LoadXml(s);

return xd;

}

return (null);

}

}

Mike
 
J

Jeffrey Tan[MSFT]

Hi Mike,

Thanks for your posting!

I think I need more information about your problem. How do you make
"ACXMLString" and "ACXMLFile" design-time only? Why do you want to "combine
these 3 properties into one property"?

I think you may explain your senario more details(such as these properties'
meaning), then we can find a correct solution for your.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
M

MLibby

Hi Jeffrey,

I was under the assumption that TypeConverters could be used at runtime.
I've since found out that TypeConverters can only be used at design time. My
original thinking was to allow one XML property to service different needs,
i.e. XMLFileName, XMLDocument, XMLString. I've since learned that this is
not feasible.

Please let me know if you've found otherwise,
MIke
 
J

Jeffrey Tan[MSFT]

Hi Mike,

Thanks very much for your feedback!

Yes, the most general usage of TypeConverter is to provide a string
representation for certain property type at design-time IDE Property
Browser. For more information, please refer to article "Make Your
Components Really RAD with Visual Studio .NET Property Browser" in MSDN.

But for your problem, I am not sure what you want to do, since you want to
combine XMLFileName, XMLDocument and XMLString into one, and they are not
wanted, why you create them? Also, I think they may be used internally, but
you do not want them to be used by other control user. For this, I think we
may specify these 3 properties as private, then use a public property to
show the essential information to the control user. This is totally based
on your control logic design.

Does the private hide 3 properties thought make sense to you? Hope I did
not misunderstand you.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner 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

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top