At the moment I am just trying to get a DesignerSerializer to work with
a CF Custom Control. I don't really care what it does, so long as it
works.
The example from the other thread is a pretty good stripped-down
example, so I've been trying to get that to work. Here's the source
code for it:
using System;
using System.Design;
using System.ComponentModel.Design.Serialization;
using System.ComponentModel.Design;
using System.ComponentModel;
using System.Windows.Forms;
[assembly:System.CF.Design.RuntimeAssembly("")]
namespace test_comp
{
[
DesignerSerializer(typeof(MyComponentSerializer),typeof(CodeDomSerializer)),
ToolboxItemFilter("System.CF.Windows.Forms",
ToolboxItemFilterType.Custom),
ToolboxItemFilter("NETCF", ToolboxItemFilterType.Require)
]
public class MyComponent : Component
{
private string myString;
public string MyString
{
get
{
return myString;
}
set
{
myString = value;
}
}
}
internal class MyComponentSerializer: CodeDomSerializer
{
public override object Deserialize(IDesignerSerializationManager
manager, object codeObject)
{
CodeDomSerializer baseSerializer =
(CodeDomSerializer)manager.GetSerializer(typeof(MyComponentSerializer).BaseType,
typeof(CodeDomSerializer));
return baseSerializer.Deserialize(manager, codeObject);
}
public override object Serialize(IDesignerSerializationManager
manager, object value)
{
MessageBox.Show("Hello There!");
CodeDomSerializer baseSerializer =
(CodeDomSerializer)manager.GetSerializer(typeof(MyComponentSerializer).BaseType,
typeof(CodeDomSerializer));
return baseSerializer.Serialize(manager, value);
}
}
}
Thanks for being willing to take a look at this!