Discussion:
Property Window and 3rd party webcontrols
(too old to reply)
Mutley
2007-03-14 16:54:09 UTC
Permalink
Hi,
I am adding custom controls to Visual studio which can then be
dragged onto a page and the controls properties appear in the property
grid window. The Font property of one of my controls appears in the
property window with a + sign beside Font which can then be expanded
to show the various sub-properties of Font. When the form is saved the
html for the page shows the following <asp:textbox id =... Font-
Bold="True" Font-Italic="True">.
I have a 3rd party control (a charting tool) that when dropped into a
page has a property called Chart that contains multiple properties for
the chart. When I look at the saved html I see the following

<cc1:GSNetWebChart ... runat="server">
<Chart ChartType="Line2D" Size="600, 400">
<ChartTitle IsVisible="True" Text="Chart Title" >
<Border FadedEdgeColor="White"
RaisedLoweredColor="Gray"></Border>
<Background GradientEndColor="MediumBlue" Color="White"></Background>

My question is what setting\attribute relating to a property causes
the Font properties to be saved as name-value pairs in the textbox
tag
whereas the chart property has its own tags in the html (I did notice
that the chart property value is a large piece of XML whereas the Font
property value was a Font object) .

Thanks in advance for any help
John
Bryan Phillips
2007-03-14 19:15:56 UTC
Permalink
The Font class has the Editor attribute defined with a UITypeEditor as
the parameter which allows it to be edited differently in a
PropertyGrid. Editing values in the PropertyGrid is not related to the
XML generated because the PropertyGrid modifies a design-time version of
your control and when you change a control's property, the HostDesigner
for the Page class serializes your property modifications to the XML
that you see. The same occurs with WindowsForms controls except that
the properties are persisted using CodeDom instead of XML.

--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com
Post by Mutley
Hi,
I am adding custom controls to Visual studio which can then be
dragged onto a page and the controls properties appear in the property
grid window. The Font property of one of my controls appears in the
property window with a + sign beside Font which can then be expanded
to show the various sub-properties of Font. When the form is saved the
html for the page shows the following <asp:textbox id =... Font-
Bold="True" Font-Italic="True">.
I have a 3rd party control (a charting tool) that when dropped into a
page has a property called Chart that contains multiple properties for
the chart. When I look at the saved html I see the following
<cc1:GSNetWebChart ... runat="server">
<Chart ChartType="Line2D" Size="600, 400">
<ChartTitle IsVisible="True" Text="Chart Title" >
<Border FadedEdgeColor="White"
RaisedLoweredColor="Gray"></Border>
<Background GradientEndColor="MediumBlue" Color="White"></Background>
My question is what setting\attribute relating to a property causes
the Font properties to be saved as name-value pairs in the textbox
tag
whereas the chart property has its own tags in the html (I did notice
that the chart property value is a large piece of XML whereas the Font
property value was a Font object) .
Thanks in advance for any help
John
Mutley
2007-03-15 09:37:49 UTC
Permalink
On Mar 14, 7:15 pm, "Bryan Phillips"
Post by Bryan Phillips
The Font class has the Editor attribute defined with a UITypeEditor as
the parameter which allows it to be edited differently in a
PropertyGrid. Editing values in the PropertyGrid is not related to the
XML generated because the PropertyGrid modifies a design-time version of
your control and when you change a control's property, the HostDesigner
for the Page class serializes your property modifications to the XML
that you see. The same occurs with WindowsForms controls except that
the properties are persisted using CodeDom instead of XML.
--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com
Post by Mutley
Hi,
I am adding custom controls to Visual studio which can then be
dragged onto a page and the controls properties appear in the property
grid window. The Font property of one of my controls appears in the
property window with a + sign beside Font which can then be expanded
to show the various sub-properties of Font. When the form is saved the
html for the page shows the following <asp:textbox id =... Font-
Bold="True" Font-Italic="True">.
I have a 3rd party control (a charting tool) that when dropped into a
page has a property called Chart that contains multiple properties for
the chart. When I look at the saved html I see the following
<cc1:GSNetWebChart ... runat="server">
<Chart ChartType="Line2D" Size="600, 400">
<ChartTitle IsVisible="True" Text="Chart Title" >
<Border FadedEdgeColor="White"
RaisedLoweredColor="Gray"></Border>
<Background GradientEndColor="MediumBlue" Color="White"></Background>
My question is what setting\attribute relating to a property causes
the Font properties to be saved as name-value pairs in the textbox
tag
whereas the chart property has its own tags in the html (I did notice
that the chart property value is a large piece of XML whereas the Font
property value was a Font object) .
Thanks in advance for any help
John- Hide quoted text -
- Show quoted text -
Thanks for your help Bryan,

I can't tell from your answer though if there is a property attribute
or setting that is used by Visual Studio to actually determine the way
it creates the HTML to represent the property value.
For example the Font property is represented by a html attribute that
is associated to the control tag whereas the Chart property is
represented in place as the value for the control tag. It appears that
Visual Studio detects a difference between these 2 properties and my
question is what is that difference?

Thanks
Bryan Phillips
2007-03-16 21:09:08 UTC
Permalink
Visual Studio uses the control's Designer attribute to determine the
class to use in order to get the html to save for the control and its
properties. Download Reflector (http://www.aisto.com/roeder) and look
at the TextBox class and the ControlDesigner class (System.Web.UI.Design
namespace in the System.Design dll). It will give you a good idea of
what is possible and also the best practice since you will be looking at
the source code for the .Net Framework itself.

--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com
Post by Mutley
On Mar 14, 7:15 pm, "Bryan Phillips"
Post by Bryan Phillips
The Font class has the Editor attribute defined with a UITypeEditor as
the parameter which allows it to be edited differently in a
PropertyGrid. Editing values in the PropertyGrid is not related to the
XML generated because the PropertyGrid modifies a design-time version of
your control and when you change a control's property, the HostDesigner
for the Page class serializes your property modifications to the XML
that you see. The same occurs with WindowsForms controls except that
the properties are persisted using CodeDom instead of XML.
--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com
Post by Mutley
Hi,
I am adding custom controls to Visual studio which can then be
dragged onto a page and the controls properties appear in the property
grid window. The Font property of one of my controls appears in the
property window with a + sign beside Font which can then be expanded
to show the various sub-properties of Font. When the form is saved the
html for the page shows the following <asp:textbox id =... Font-
Bold="True" Font-Italic="True">.
I have a 3rd party control (a charting tool) that when dropped into a
page has a property called Chart that contains multiple properties for
the chart. When I look at the saved html I see the following
<cc1:GSNetWebChart ... runat="server">
<Chart ChartType="Line2D" Size="600, 400">
<ChartTitle IsVisible="True" Text="Chart Title" >
<Border FadedEdgeColor="White"
RaisedLoweredColor="Gray"></Border>
<Background GradientEndColor="MediumBlue" Color="White"></Background>
My question is what setting\attribute relating to a property causes
the Font properties to be saved as name-value pairs in the textbox
tag
whereas the chart property has its own tags in the html (I did notice
that the chart property value is a large piece of XML whereas the Font
property value was a Font object) .
Thanks in advance for any help
John- Hide quoted text -
- Show quoted text -
Thanks for your help Bryan,
I can't tell from your answer though if there is a property attribute
or setting that is used by Visual Studio to actually determine the way
it creates the HTML to represent the property value.
For example the Font property is represented by a html attribute that
is associated to the control tag whereas the Chart property is
represented in place as the value for the control tag. It appears that
Visual Studio detects a difference between these 2 properties and my
question is what is that difference?
Thanks
Loading...