PC Review


Reply
Thread Tools Rate Thread

Component does not undo/redo in design view... !!!

 
 
=?Utf-8?B?RVJEQUw=?=
Guest
Posts: n/a
 
      23rd Aug 2005
I have a custom class using ExpandableObject Converter for code serialization
in design time. When I use this class as a property (get) in a component, the
property changes in the property browser serialized correctly in the
components code (InitializeComponent method) and the changes are persisted.
No problem with that. BUT! While component is in design view, the changes to
the properties of my class does not undo, even it shows the changes in the
undo list of VS.IDE.

Note: I dont want my class to be structure. I know it would work correctly ,
if I used a structure instead of a class and a fully implemented
typeconverter for it. I want it to be a class and it should be read only(
only get accessor implemented) property, when used in a component.

Example:

[TypeConverter(typeof(ExpandableObjectConverter))]
public class UndoClass
{
int _x =0;
int _y =0;

[DefaultValue(0)]
public int X
{
get{ return _x;}
set{ _x = value;}
}

[DefaultValue(0)]
public int Y
{
get{ return _y;}
set{ _y = value;}
}
}

I use the class as component property in a component:

public class MyComponent : System.ComponentModel.Component
{
....
....

UndoClass _undoClass = new UndoClass();

[DesignerSerializationVisibility(
DesignerSerializationVisibility.Content)]
[Browsable( true)]
public UndoClass UndoClass
{
get{ return _undoClass;}
}
}

In the first instance, designer does not show the property in the property
browser. Because of this, I need to inherit my component again to show my
UndoClass property in the property browser:

public class UndoComponent : MyComponent
{
.....
.....
}

Now, make changes to UndoClass property in UndoComponent "design view". You
will see those changes in the undo list of the idee. But when you undo
them(in design view), nothing will happen. Can anyone help me? What can I do
to make undo and redo to work.

Please note, using PropertyDescriptor.SetValue or
DesignerHost.CreateTransaction doesn't help. Because, the changes are being
made in the properties window directly.

THANKS

 
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
Undo Redo Carl Microsoft VB .NET 0 7th Oct 2010 09:53 AM
Re: undo redo Cor Ligthert[MVP] Microsoft VB .NET 0 17th Mar 2010 08:51 AM
? Redo command (undo undo) Alec S. Windows XP Basics 2 8th Apr 2004 01:13 AM
? Redo command (undo undo) Alec S. Windows XP Help 0 7th Apr 2004 06:17 AM
? Redo command (undo undo) Alec S. Windows XP General 0 7th Apr 2004 06:16 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:22 PM.