Hierarchical Component Editor

G

Guest

Hi,
When you use the Datagrid, editing TableStyles, you can add ColumnStyles using the design time editor. On the ColumnStyle design time editor, there is a Add button where there is a drop arrow where you can choose between a DataGridBoolColumn and DataGridTextBoxColumn to add.

I wish to have the same exact dialog for my components with the difference that I would like to list in that drop arrow my own types.

Actually I have a component called MyMenuSystem where I would like to add, at design time, child MyMenuSystemTextItem and MyMenuSystemButtonItem... the same way you can add DataGridBoolColumn and DataGridTextBoxColumn to a DataGridColumnStyleCollection.

How can I do this? Is it just a mather of putting some attributes to my class to have the default collection design time editor to adapt to multiple types or I must redo a complete design time control??

JPRoot
 
J

Jeffrey Tan[MSFT]

Hi jproot

I will do some research on this issue, I will reply to you ASAP.

Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
J

Jeffrey Tan[MSFT]

Hi JPRoot,

Thank you for posting in the community! Sorry for letting you wait for so
long time.

Based on my understanding, you want to add more types to your collection
property's "Add" button.(Appear as a menu button in the editor form)

==========================================================
Actually, in .Net designer, CollectionEditor class is used to edit the
collection property. To add more types to your member "Add" button, you can
inherit CollectionEditor class and override CreateNewItemTypes() method to
return your customized types.

You can try the following Solution to see if it helps resolve your issue:

private object [] col;

[Editor(typeof(MyCollectionEditor),typeof(System.Drawing.Design.UITypeEditor
))]
public object[] Col
{
get
{
return col;
}
set
{
col=value;
}
}

public class MyCollectionEditor :
System.ComponentModel.Design.CollectionEditor
{
public MyCollectionEditor(Type t): base(t)
{
}

protected override Type[] CreateNewItemTypes()
{
return new Type[] {typeof(MyItem), typeof(MyOtherItem) };
}
}

class MyItem
{
}

class MyOtherItem
{
}

=========================================================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Have a nice day!!

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
J

Jeffrey Tan[MSFT]

Hi JPRoot,

Is your problem resolved?
If you still have anything unclear, please feel free to tell me, I will
help you.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
G

Guest

Hi JPRoot,

Thanks very much for your a little late feedback :)

Anyway, I am glad I can help you. If you have any further problem, please
feel free to post, I will help you.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top