By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,172 Members | 1,146 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,172 IT Pros & Developers. It's quick & easy.

Properties of Properties

P: n/a
I have a System.Web.UI.Control which has a property of type
System.Drawing.Font. When editing this control in an *.aspx file, how do I
assign a value to this property? If I recall correctly, the attributes in
the server tag are a combination of the property name and the property of
that property separated by a "-" or something. However, I would also like to
be able to use the Property Grid to do this. I tried using the Browsable
attribute for the property, but that did not seem to help. Here is my
current code for the property:

<System.ComponentModel.Browsable(True)WriteOnly Property Font() As
System.Drawing.Font
Set(ByVal value As System.Drawing.Font)
Me._font = value
End Set
End Property

Am I forgetting something? Any help would be appreciated. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Oct 27 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
in general the property designer only support simple types by default
(string, numbers, enum). while the designer knows about color and size,
window fonts are not included. you will need to write your own prop designer
to support them. in the asp.net syntax, all properties must be able to be
specified as a string.

as fonts are specified to the browser via a style command, not sure why you
do not just support a style and class (CSSClass) properties.
-- bruce (sqlwork.com)
"Nathan Sokalski" wrote:
I have a System.Web.UI.Control which has a property of type
System.Drawing.Font. When editing this control in an *.aspx file, how do I
assign a value to this property? If I recall correctly, the attributes in
the server tag are a combination of the property name and the property of
that property separated by a "-" or something. However, I would also like to
be able to use the Property Grid to do this. I tried using the Browsable
attribute for the property, but that did not seem to help. Here is my
current code for the property:

<System.ComponentModel.Browsable(True)WriteOnly Property Font() As
System.Drawing.Font
Set(ByVal value As System.Drawing.Font)
Me._font = value
End Set
End Property

Am I forgetting something? Any help would be appreciated. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Oct 27 '08 #2

P: n/a
My reason for not using a style and class is because the control will be
generating an image, and therefore needs a System.Drawing.Font object.
Assuming you are correct in your statements, I will probably need to just
make separate properties and use the System.Drawing.Font constructor to
create the font. I was just hoping to not need to make separate properties,
but I guess that's all I can do for now since I don't know how to make
Property Designers yet (and there probably wouldn't be much point in this
case, since I only have one control that would need it). Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"bruce barker" <br*********@discussions.microsoft.comwrote in message
news:28**********************************@microsof t.com...
in general the property designer only support simple types by default
(string, numbers, enum). while the designer knows about color and size,
window fonts are not included. you will need to write your own prop
designer
to support them. in the asp.net syntax, all properties must be able to
be
specified as a string.

as fonts are specified to the browser via a style command, not sure why
you
do not just support a style and class (CSSClass) properties.
-- bruce (sqlwork.com)
"Nathan Sokalski" wrote:
>I have a System.Web.UI.Control which has a property of type
System.Drawing.Font. When editing this control in an *.aspx file, how do
I
assign a value to this property? If I recall correctly, the attributes in
the server tag are a combination of the property name and the property of
that property separated by a "-" or something. However, I would also like
to
be able to use the Property Grid to do this. I tried using the Browsable
attribute for the property, but that did not seem to help. Here is my
current code for the property:

<System.ComponentModel.Browsable(True)WriteOnly Property Font() As
System.Drawing.Font
Set(ByVal value As System.Drawing.Font)
Me._font = value
End Set
End Property

Am I forgetting something? Any help would be appreciated. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Oct 27 '08 #3

P: n/a
You should be able to work with this property in the property grid. The
System.Drawing.Font type has an associated editor, which the property grid
should expose to you.

What happens in the property grid?
--
John Saunders | MVP - Connected System Developer

Oct 27 '08 #4

P: n/a
All the Property Grid shows is the name of the property and a place to enter
a value. It shows up the same way a property of type String or Integer or
would. Is there an Property Attribute I need to add to make the associated
editor available? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"John Saunders" <no@dont.do.that.comwrote in message
news:e3****************@TK2MSFTNGP05.phx.gbl...
You should be able to work with this property in the property grid. The
System.Drawing.Font type has an associated editor, which the property grid
should expose to you.

What happens in the property grid?
--
John Saunders | MVP - Connected System Developer

Oct 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.