In PropertyGrid, how does one implement multi-level set value transfer?

Source: Internet
Author: User

The younger brother encountered a problem when using PropertyGrid. Please help me.

The problem is as follows:

Suppose there is a program like this

 

This section of code is roughly as follows:

Namespace PropertyTest {
Public partial class Form1: Form {
Public Form1 (){
InitializeComponent ();
PropertyGrid1.SelectedObject = new Fun ();
}
}

Public class Fun {
Private List <TestArray> test = new List <TestArray> ();

Public string Name {get; set ;}
Public int Num {get; set ;}
Public List <TestArray> Test {get; set ;}

}

}

 

Click Test to enter the following form:

 

Text is bound to a custom form. The TestArray code is as follows:

Public class TestArray {

Public string TempName {get; set ;}
Public int TempNum {get; set ;}

[Editor (typeof (TextEditor), typeof (System. Drawing. Design. UITypeEditor)]
Public string Text {get; set ;}

}

The Editor code is as follows:

Namespace PropertyTest {
Public class TextEditor: UITypeEditor {
Public override UITypeEditorEditStyle GetEditStyle (ITypeDescriptorContext context ){
Return UITypeEditorEditStyle. Modal;
}

Public override object EditValue (ITypeDescriptorContext context, IServiceProvider provider, object value ){
IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService) provider. GetService (typeof (IWindowsFormsEditorService ));
If (edSvc! = Null ){
TextInput t = new TextInput (edSvc );
EdSvc. ShowDialog (t );
Return t. S;
}
Return value;
}
}

}

 

My problem is how to get the Name and Num values of the top-level window in EditValue of Editor. Please help.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.