Is there a way to programmatically display a collection editor?

O

opellegr

Are there no newsgroups for WPF? This is the closest match I could find.
Maybe some should be created?

I'm working on the design-time experience for a WPF control. Most of the
user's interactions with the control involves modification of a few
collection properties. I'd like to make an adorner that opens the collection
editor for a specific property, but I haven't been able to find code to do
so. Is there a way to programmatically display a collection editor for a
property?
 
A

Andrew Faust

I'm not sure you want to build something like this as an Adorner.

Check out the open source WPF PropertyGrid Control. Even if you can't use it
directly in your project, it should have code you can look at to help you
with what you're doing.

http://www.codeplex.com/wpfpropertygrid

Andrew Faust
 
O

opellegr

Note that I'm writing the design-time experience for a control, not the
runtime experience. I have custom editors defined for custom types, and I'd
love to be able to do these. The property grid you linked to is impressive,
but has no functionality to look for the custom design-time property editors
for types. I tested this myself on a type with custom property editors.
Furthermore, I'm not helping the user out very much if I give them a shortcut
to an inferior copy of the property grid that already exists in their
programming tool.

The Windows Forms property grid had this functionality if I recall, but in
WinForms design-time metadata was directly associated with types; for a
property grid to work in WPF then there needs to be a dependency on the
design-time code from the runtime code. This is something that is
discouraged, so I don't believe WPF will ever have a fully functional
property grid. Windows Forms also provided smart tags at design-time through
the ControlDesigner class, which is how this functionality was implemented in
our Windows Forms controls. Sadly, this is not provided in WPF's design-time
model either, and implementation is made somewhat difficult since the
implementation would be tasked with emulating the designer.

The property is a collection of a custom type that must be configured, and
the custom type's properties have custom property editors as well. I want to
provide something easier than "go find property x in the property grid".
Currently I'm assuming there's no way to display the collection editor and
designing things with that in mind.
 

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