PC Review


Reply
Thread Tools Rate Thread

Re: 2005 Control Designer

 
 
David McNamee
Guest
Posts: n/a
 
      13th Jun 2005
"Keith Welch" <keith@NoSpam_mooseworkssoftware.com> wrote in message
news:%(E-Mail Removed)...
>I am having trouble with type converters in 2005 while creating custom
>controls. While the control can serialize simple properties at design time,
>I cannot get it to serialize class type properties.


I'm not sure yet how the custom control infrastructure has changed in Visual
Studio 2005, but in prior versions classes needed a parameterless default
constructor in order for automatic serialization to happen. Try adding an
empty new() method to your TestClass code and see what happens.


--
David McNamee
Mobility Architect
developerLabs, Inc
http://www.developerLabs.NET/


 
Reply With Quote
 
 
 
 
Keith Welch
Guest
Posts: n/a
 
      13th Jun 2005
Hmm, I did not know that - did it by accident apparently. I'll give that a
try when I get back to the beta. My only concern is that the serialization
should use the constructor with parameters as defined in ConvertTo. Thanks,
Keith

"David McNamee" <(E-Mail Removed)>
wrote in message news:(E-Mail Removed)...
> "Keith Welch" <keith@NoSpam_mooseworkssoftware.com> wrote in message
> news:%(E-Mail Removed)...
>>I am having trouble with type converters in 2005 while creating custom
>>controls. While the control can serialize simple properties at design
>>time, I cannot get it to serialize class type properties.

>
> I'm not sure yet how the custom control infrastructure has changed in
> Visual Studio 2005, but in prior versions classes needed a parameterless
> default constructor in order for automatic serialization to happen. Try
> adding an empty new() method to your TestClass code and see what happens.
>
>
> --
> David McNamee
> Mobility Architect
> developerLabs, Inc
> http://www.developerLabs.NET/
>



 
Reply With Quote
 
Keith Welch
Guest
Posts: n/a
 
      14th Jun 2005
Sorry, that didn't work. The 2005 structure is quite different than 2003.
There are no longer designer control versions, and editors/ type converters
attributes are called out in an xml file, and are implemented in a separate
windows forms dll. The type converter I have will work in 2003 and 2005
desktop, but not here. The property should serialize something like:
UserControl1.TestClass = new TestClass("test", 42.0);
I hope the problem description is clear. Thanks,
Keith Welch

"David McNamee" <(E-Mail Removed)>
wrote in message news:(E-Mail Removed)...
> "Keith Welch" <keith@NoSpam_mooseworkssoftware.com> wrote in message
> news:%(E-Mail Removed)...
>>I am having trouble with type converters in 2005 while creating custom
>>controls. While the control can serialize simple properties at design
>>time, I cannot get it to serialize class type properties.

>
> I'm not sure yet how the custom control infrastructure has changed in
> Visual Studio 2005, but in prior versions classes needed a parameterless
> default constructor in order for automatic serialization to happen. Try
> adding an empty new() method to your TestClass code and see what happens.
>
>
> --
> David McNamee
> Mobility Architect
> developerLabs, Inc
> http://www.developerLabs.NET/
>



 
Reply With Quote
 
Peter Foot [MVP]
Guest
Posts: n/a
 
      14th Jun 2005
If you class exposes only simple typed properties then you should be able to
use the ExpandableObjectConverter. This xml worked with a previous build of
Visual Studio, I've not had chance to carry on this work with Beta 2, but
this shows the xml used for the ProcessStartInfo class which is used by the
Process class in the SDF:-

<Class Name="OpenNETCF.Diagnostics.ProcessStartInfo">

<DesktopCompatible>false</DesktopCompatible>
<DesignTimeVisible>true</DesignTimeVisible>

<TypeConverter>System.ComponentModel.ExpandableObjectConverter, System,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089</TypeConverter>
<Property Name="Arguments">
<Browsable>true</Browsable>
<DesignerSerializationVisibility>Content</DesignerSerializationVisibility>
<NotifyParentProperty>true</NotifyParentProperty>
</Property>

<Property Name="FileName">
<Browsable>true</Browsable>
<DesignerSerializationVisibility>Content</DesignerSerializationVisibility>
<NotifyParentProperty>true</NotifyParentProperty>
</Property>

<Property Name="UseShellExecute">
<Browsable>true</Browsable>
<DefaultValue>
<Type>System.Boolean</Type>
<Value>True</Value>
</DefaultValue>
<DesignerSerializationVisibility>Content</DesignerSerializationVisibility>
<NotifyParentProperty>true</NotifyParentProperty>
</Property>

<Property Name="Verb">
<Browsable>true</Browsable>
<DefaultValue>
<Type>System.String</Type>
<Value></Value>
</DefaultValue>
<DesignerSerializationVisibility>Content</DesignerSerializationVisibility>
<NotifyParentProperty>true</NotifyParentProperty>
</Property>

<Property Name="WindowStyle">
<Browsable>false</Browsable>
<DefaultValue>
<Type>System.Int32</Type>
<Value>0</Value>
</DefaultValue>
<DesignerSerializationVisibility>Hidden</DesignerSerializationVisibility>
</Property>

</Class>

Peter

--
Peter Foot
Windows Embedded MVP
http://www.inthehand.com | http://www.peterfoot.net |
http://www.opennetcf.org

"Keith Welch" <keith@nospam_mooseworkssoftware.com> wrote in message
news:ub$(E-Mail Removed)...
> Sorry, that didn't work. The 2005 structure is quite different than 2003.
> There are no longer designer control versions, and editors/ type
> converters attributes are called out in an xml file, and are implemented
> in a separate windows forms dll. The type converter I have will work in
> 2003 and 2005 desktop, but not here. The property should serialize
> something like:
> UserControl1.TestClass = new TestClass("test", 42.0);
> I hope the problem description is clear. Thanks,
> Keith Welch
>
> "David McNamee"
> <(E-Mail Removed)> wrote in
> message news:(E-Mail Removed)...
>> "Keith Welch" <keith@NoSpam_mooseworkssoftware.com> wrote in message
>> news:%(E-Mail Removed)...
>>>I am having trouble with type converters in 2005 while creating custom
>>>controls. While the control can serialize simple properties at design
>>>time, I cannot get it to serialize class type properties.

>>
>> I'm not sure yet how the custom control infrastructure has changed in
>> Visual Studio 2005, but in prior versions classes needed a parameterless
>> default constructor in order for automatic serialization to happen. Try
>> adding an empty new() method to your TestClass code and see what happens.
>>
>>
>> --
>> David McNamee
>> Mobility Architect
>> developerLabs, Inc
>> http://www.developerLabs.NET/
>>

>
>



 
Reply With Quote
 
Keith Welch
Guest
Posts: n/a
 
      15th Jun 2005
Hi Peter,
Thanks, this was closer, but not quite. It does serialize the class by
creating a local variable and then trying to assign it to the property,
like:
ControlLibrary1.TestClass testClass1 = new ControlLibrary1.TestClass();
//
// userControl11
//
testClass1.Name = "test67";
testClass1.Value = 42;
this.userControl11.TestClass = testClass1;

Unfortunately, once I close and reopen the designer, I get an error: "Object
of type 'Microsoft.CompactFramework.Design.UnsafeComponent' cannot be
converted to type 'ControlLibrary1.TestClass'." on the line where the
TestClass property is assigned. I was actually trying to get it to use a
constructor with parameters, like the font:
this.Font = new System.Drawing.Font("Tahoma", 9F,
System.Drawing.FontStyle.Bold);
Thanks,
Keith


"Peter Foot [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> If you class exposes only simple typed properties then you should be able
> to use the ExpandableObjectConverter. This xml worked with a previous
> build of Visual Studio, I've not had chance to carry on this work with
> Beta 2, but this shows the xml used for the ProcessStartInfo class which
> is used by the Process class in the SDF:-
>
> <Class Name="OpenNETCF.Diagnostics.ProcessStartInfo">
>
> <DesktopCompatible>false</DesktopCompatible>
> <DesignTimeVisible>true</DesignTimeVisible>
>
> <TypeConverter>System.ComponentModel.ExpandableObjectConverter, System,
> Version=2.0.0.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089</TypeConverter>
> <Property Name="Arguments">
> <Browsable>true</Browsable>
>
> <DesignerSerializationVisibility>Content</DesignerSerializationVisibility>
> <NotifyParentProperty>true</NotifyParentProperty>
> </Property>
>
> <Property Name="FileName">
> <Browsable>true</Browsable>
>
> <DesignerSerializationVisibility>Content</DesignerSerializationVisibility>
> <NotifyParentProperty>true</NotifyParentProperty>
> </Property>
>
> <Property Name="UseShellExecute">
> <Browsable>true</Browsable>
> <DefaultValue>
> <Type>System.Boolean</Type>
> <Value>True</Value>
> </DefaultValue>
>
> <DesignerSerializationVisibility>Content</DesignerSerializationVisibility>
> <NotifyParentProperty>true</NotifyParentProperty>
> </Property>
>
> <Property Name="Verb">
> <Browsable>true</Browsable>
> <DefaultValue>
> <Type>System.String</Type>
> <Value></Value>
> </DefaultValue>
>
> <DesignerSerializationVisibility>Content</DesignerSerializationVisibility>
> <NotifyParentProperty>true</NotifyParentProperty>
> </Property>
>
> <Property Name="WindowStyle">
> <Browsable>false</Browsable>
> <DefaultValue>
> <Type>System.Int32</Type>
> <Value>0</Value>
> </DefaultValue>
>
> <DesignerSerializationVisibility>Hidden</DesignerSerializationVisibility>
> </Property>
>
> </Class>
>
> Peter
>
> --
> Peter Foot
> Windows Embedded MVP
> http://www.inthehand.com | http://www.peterfoot.net |
> http://www.opennetcf.org
>
> "Keith Welch" <keith@nospam_mooseworkssoftware.com> wrote in message
> news:ub$(E-Mail Removed)...
>> Sorry, that didn't work. The 2005 structure is quite different than 2003.
>> There are no longer designer control versions, and editors/ type
>> converters attributes are called out in an xml file, and are implemented
>> in a separate windows forms dll. The type converter I have will work in
>> 2003 and 2005 desktop, but not here. The property should serialize
>> something like:
>> UserControl1.TestClass = new TestClass("test", 42.0);
>> I hope the problem description is clear. Thanks,
>> Keith Welch
>>
>> "David McNamee"
>> <(E-Mail Removed)> wrote in
>> message news:(E-Mail Removed)...
>>> "Keith Welch" <keith@NoSpam_mooseworkssoftware.com> wrote in message
>>> news:%(E-Mail Removed)...
>>>>I am having trouble with type converters in 2005 while creating custom
>>>>controls. While the control can serialize simple properties at design
>>>>time, I cannot get it to serialize class type properties.
>>>
>>> I'm not sure yet how the custom control infrastructure has changed in
>>> Visual Studio 2005, but in prior versions classes needed a parameterless
>>> default constructor in order for automatic serialization to happen. Try
>>> adding an empty new() method to your TestClass code and see what
>>> happens.
>>>
>>>
>>> --
>>> David McNamee
>>> Mobility Architect
>>> developerLabs, Inc
>>> http://www.developerLabs.NET/
>>>

>>
>>

>
>



 
Reply With Quote
 
Ralf Heitmann
Guest
Posts: n/a
 
      15th Jun 2005
Hi,
I'm just beginning to Convert our CF1 Custom controls (with Designer
support) for the CF2.

Is there any information available yet about changes in the Designer
Infrastructure yet?

Ralf


Peter Foot [MVP] wrote:
> If you class exposes only simple typed properties then you should be able to
> use the ExpandableObjectConverter. This xml worked with a previous build of
> Visual Studio, I've not had chance to carry on this work with Beta 2, but
> this shows the xml used for the ProcessStartInfo class which is used by the
> Process class in the SDF:-
>
> <Class Name="OpenNETCF.Diagnostics.ProcessStartInfo">
>
> <DesktopCompatible>false</DesktopCompatible>
> <DesignTimeVisible>true</DesignTimeVisible>
>
> <TypeConverter>System.ComponentModel.ExpandableObjectConverter, System,
> Version=2.0.0.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089</TypeConverter>
> <Property Name="Arguments">
> <Browsable>true</Browsable>
> <DesignerSerializationVisibility>Content</DesignerSerializationVisibility>
> <NotifyParentProperty>true</NotifyParentProperty>
> </Property>
>
> <Property Name="FileName">
> <Browsable>true</Browsable>
> <DesignerSerializationVisibility>Content</DesignerSerializationVisibility>
> <NotifyParentProperty>true</NotifyParentProperty>
> </Property>
>
> <Property Name="UseShellExecute">
> <Browsable>true</Browsable>
> <DefaultValue>
> <Type>System.Boolean</Type>
> <Value>True</Value>
> </DefaultValue>
> <DesignerSerializationVisibility>Content</DesignerSerializationVisibility>
> <NotifyParentProperty>true</NotifyParentProperty>
> </Property>
>
> <Property Name="Verb">
> <Browsable>true</Browsable>
> <DefaultValue>
> <Type>System.String</Type>
> <Value></Value>
> </DefaultValue>
> <DesignerSerializationVisibility>Content</DesignerSerializationVisibility>
> <NotifyParentProperty>true</NotifyParentProperty>
> </Property>
>
> <Property Name="WindowStyle">
> <Browsable>false</Browsable>
> <DefaultValue>
> <Type>System.Int32</Type>
> <Value>0</Value>
> </DefaultValue>
> <DesignerSerializationVisibility>Hidden</DesignerSerializationVisibility>
> </Property>
>
> </Class>
>
> Peter
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Can I create a custom control with a designer like a form designer trant Microsoft C# .NET 5 23rd Dec 2009 12:03 AM
Visual Studio 2005 Custom Control Designer Support Enemaerke Microsoft Dot NET Compact Framework 3 22nd Apr 2006 12:49 PM
VS 2005 Designer problem Dino Buljubasic Microsoft Dot NET Framework 1 7th Jan 2006 07:34 AM
why can't vs 2005 class designer do UML bonk Microsoft C# .NET 3 3rd Nov 2005 04:45 PM
Control designer as form designer Michiel Microsoft VB .NET 1 13th Aug 2004 02:44 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:12 AM.