Windows Develop Bookmark and Share   
 index > Windows Forms General > Howto? sub-property in property grid : but only "visual" not in code...
 

Howto? sub-property in property grid : but only "visual" not in code...

Hello all,

I've a rehosted designer and property grid (actually for Workflows, but this seems to be nothing workflow-related).
I have a control (in fact an "Activity" but this shoudn't matter), with a lot of dependency properties.
Like:

FieldName01
FieldValue01
FieldName02
FieldValue02
FieldName03
FieldValue03
...

(no I can't use a collection as collections aren't fully supported by the workflow-engine until now...)

As this looks silly I want to make it like this in the property grid

[+] Field01
[+] Field02
[+] Field03

and when we click on [+] it expands so
[ ] Field01
FieldName01
FieldValue01
[+] Field02
[+] Field03

How can I achieve this?

Thanks for any hint...

Just to be sure: What I don't want (I know this is possible with an TypeConverter):

Field01 = "FieldName01=EnteredValue, FieldValue01=AnotherValue"
(and that "FieldName01" and "FieldValue01" doesn't exist as "real" dependency properties, they are only showed for easier editing by the TypeConverter when editing...)

Bye
Sven

P.S.: If someone knows how to get the toolbox on the left from VS into an own application???
As far as I know this is not possible... Currently I'm using just a "ListBox" with "IServiceToolbox", but this has no "tabs" in it which would be very useful...



svenni_uwe  Sunday, June 01, 2008 8:09 PM

Hi svenni_uwe,

I am not very clear about what you want? Did you mean you want to do something like described in the following article?

For your second question, you can create your own control that act like the ToolBox.

Hope this helps.
Best regards.
Rong-Chun Zhang

Windows Forms General FAQs
Windows Forms Data Controls and Databinding FAQs

Rong-Chun Zhang  Thursday, June 05, 2008 11:15 AM

Hi svenni_uwe,

I am not very clear about what you want? Did you mean you want to do something like described in the following article?

For your second question, you can create your own control that act like the ToolBox.

Hope this helps.
Best regards.
Rong-Chun Zhang

Windows Forms General FAQs
Windows Forms Data Controls and Databinding FAQs

Rong-Chun Zhang  Thursday, June 05, 2008 11:15 AM


Hello Rong-Chun,

thank you for your answer. Yes reagarding the first sampe on codeproject, I need some kind of "nestedTypes" in the property grid. But the "parent"-Type has to exists only "virtually", only for the display.

I want two "normal" dependencyProperties:

Field01Name (String)
Field01Value (String)


(the should be accessed from elsewhere by ....Field01Value = "xxx" or ...Field01Value = "yyy".

But in the grid if want this display:

[+] Field01

and if you click on "[+]" you see
[-] Field01
Field01Name (String)
Field01Value (String)

So "Field01" should be only for display, it should contain NO VALUE AT ALL. (and be "itself" no "true" property)

Is this possible?

Thanks,
Sven

P.S.: Ok, so it is definitely not possible to use the "original" VS-Toolbox... Thanks for the example...

svenni_uwe  Thursday, June 05, 2008 12:49 PM

Hisvenni_uwe,

As far as I know, you will have to provide a custom TypeConverter to do this stuff. You can create your own TypeConverter and override the ConvertTo to display nothing for the parent node and override the GetProperties to provide the nested node.

Here are some samples to implement a TypeConverter:
http://msdn.microsoft.com/en-us/library/ayybcxe5(VS.80).aspx
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2512532&SiteID=1

Hope this helps.
Best regards.
Rong-Chun Zhang

Windows Forms General FAQs
Windows Forms Data Controls and Databinding FAQs

Rong-Chun Zhang  Friday, June 06, 2008 7:22 AM

You can use google to search for other answers

Custom Search

More Threads

• Register single and double click
• cascading
• Struct Dynamic Array
• Crystal Reports HELP?
• Two (or More) windows with OpenGL
• Label with html entries
• loop through dataset and populate textboxes
• Drag and Drop Label created on runtime for each generic.list item
• Design Question
• how to pass values to another windows application?