Home All Groups Group Topic Archive Search About

Trouble serializing property from Designer

Author
1 Sep 2006 10:21 AM
Mario Vázquez
Hi,
I've a component with a UITypeEditor (form) attached. The component has a
Designer attached too, and I'm opening the typeeditor form from that
designer, through a new verb I've created:

// Designer code fragment
public override DesignerVerbCollection Verbs
  {
   get
   {
    DesignerVerb[] verbs = new DesignerVerb[]
     {new DesignerVerb("Config Component", new
EventHandler(OnConfigComponent))};
    return new DesignerVerbCollection(verbs);
   }
  }

I open the form when the new verb is clicked from the component's context
menu. I pass my component to the form's constructor in order to change its
properties from it.

  private void OnConfigComponent(object sender, EventArgs e)
  {
    MyComponent cmp = (MyComponent)this.Component;
   MyComponentEditorForm frm = new MyComponentEditorForm(cmp);
   frm.ShowDialog();
  }

It seems that all works right. I click de new menu verb and the form opens.
I change something in the form in the way:

this.ComponentReference.FakeProp = "OOOOOHHH!";

When I close the form, MyComponent has been changed, but not at all, it
seems:

- The new FakeProp value is not show in the property browser until I
unselect and select again the component.
- When I close the form where the component is sited and re-open it, the new
property value has been lost.

What I'm doing wrong? Is not possible to do this (change a component thruogh
an editor form open from a designer)?

Thanks for any help.
Regards,

Mario Vazquez

AddThis Social Bookmark Button