Problem during testing the property grid

Sep 10, 2009 at 2:21 PM

I am trying to create a new project, where a class is instantiated. I add reference to the exe file and do like the following:

Person person = new Person(12);

Deepforest.WPF.Controls.PropertyGrid wpg = new Deepforest.WPF.Controls.PropertyGrid();

wpg.Instance = person;

But nothing is shown up. How to handle this problem?

Sep 10, 2009 at 4:59 PM

I would recommend you to create a Window, and put the 'wpg' instance you've just created as the Window.Content.

Then show the window!

Best :)

Sep 11, 2009 at 6:43 AM

Your suggestion makes sense to figure out the problem

Now I create a Winform and a 'wpg' instance.  But the problem is how to set the 'wpg' instance as  the  winform's content? It is different from creating a button in a winform.

If your create a button on a winform, you could instantiate an instance of a Button and then


I am fresh to this field, sorry for the "stupid" question. Appreciated.


Sep 11, 2009 at 6:48 AM

wpg is for WPF, you aware of that right?

If you're using WinForms, you've to host the wpg control using an ElementHost (you can find it in the WinForms toolbar).

Another question, if you're working with WinForms, why don't you use the WinForms property grid?

Sep 11, 2009 at 7:17 AM


The reason why I choose this indirect solution is that with wpf my application can achieve a more flexible theme, while the main application is rendered in winform.

I have tired the elementhost as following, where the elementhost property is supposed to be shown up:


this.elementHost1 = new System.Windows.Forms.Integration.ElementHost();
this.wpg = new Deepforest.WPF.Controls.PropertyGrid();
this.wpg.Instance = this.elementHost1;
this.elementHost1.Dock = System.Windows.Forms.DockStyle.Fill;
this.elementHost1.Location = new System.Drawing.Point(0, 0);
this.elementHost1.Name = "elementHost1";
this.elementHost1.Size = new System.Drawing.Size(292, 266);
this.elementHost1.TabIndex = 0;
this.elementHost1.Text = "elementHost1";
 this.elementHost1.Child = this.wpg;

Unfortuately, nothing is shown up as well. Confusing?

Sep 11, 2009 at 7:20 AM

You've called this.SuspendLayout(), what about this.ResumeLayout() ?

Sep 11, 2009 at 7:28 AM

I've added reference to the assembly, and wrote this (user code):

public partial class Form1 : Form


    public Form1()




        this.elementHost1.Child = new Deepforest.WPF.Controls.PropertyGrid()


            Instance = this





It works for me! 

Sep 11, 2009 at 7:30 AM

It still fails with this.ResumeLayout(). Any idea?

Do I need to send the test application to you?

Sep 11, 2009 at 7:32 AM

Fill free to send me a link where I can download your test app.

Sep 11, 2009 at 7:37 AM

I am sorry since there is no link to the test app for downloading, so you have to tell me your email. Another option is that  If you have make it works, could you send it to my email

Thank you so much. 




Sep 11, 2009 at 7:40 AM
Edited Sep 11, 2009 at 7:41 AM

It's in your inbox ;-)

Sep 11, 2009 at 7:50 AM

Thank you very much. It works fine now.

(1) How could you get the Deepforest.WPF.Controls.dll? With the downloaded source code, there is no dll file exported.

(2) One more question is why the theme of the property grid is different from the demo I downloaded from the website?


Sep 11, 2009 at 8:35 AM
Edited Sep 11, 2009 at 8:37 AM

I've sent you my new source - I didn't upload it to the project yet, but it has many changes.

The POC currently available here is only a demo. It's not custom control, and this is why you've problems.

As for the theme, you may use this.

Sep 11, 2009 at 8:56 AM

Thanks a lot for the updated version. But there are two compilation errors during build.

(1) Error 1 Metadata file 'C:\Documents and Settings\LiM\Desktop\WPFPropertyGrid\Deepforest.WPF.Controls\bin\Debug Test\Deepforest.WPF.Controls.dll' could not be found

(2) Error 3 The tag 'DatePicker' does not exist in XML namespace 'clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit'. Line 259 Position 6. C:\Documents and Settings\LiM\Desktop\WPFPropertyGrid\Deepforest.WPF.Controls\Themes\Generic.xaml 259 6

I find out that the reference of WPFToolkit is not available, which is indicated by a question mark in the solution explorer.

Sep 11, 2009 at 10:47 AM

Yes I forgot to mention, download and install the WPFToolkit.

Sep 11, 2009 at 12:24 PM

I am extremely attracted by what you have done regarding WPF stuff. The updated version can be exported a dll file, so it is easier for me to apply your contribution to my application directly. Very grateful about it.

(1) The only tricky part in the updated version is defining the theme of the property grid. For the previous version, the property grid theme can be specified by separately restyling the expander, the combobox, etc.

      For the second version, I can not understand how to restyle the property grid. Maybe I will customize the property grid depending on my application. Whether it is possible to use the previous solution to restyle

      the property grid in the second version.

(2) With the theme link you posted before, I find a couple of options.  For instance the BureauBlackTheme, whether it is possible to apply these themes into the property grid. If yes, how?




Sep 11, 2009 at 1:58 PM

Thanks, its my pleasure.

As for the styling question, since wpg uses standard controls: ListBox, Expander, etc, you may select whatever theme you like, and it will be automatically applied to the property grid.

Sep 11, 2009 at 2:07 PM

Could you give me an example about how to apply a theme to the property grid, for instance "BureauBlackTheme".

Sep 11, 2009 at 2:10 PM

Yes, you may find it in the same theme project I gave you. here.

Sep 12, 2009 at 10:45 AM

I have tried applying different themes into the second version you emailed, but failed. So I am wondering whether it is possible to integrate the theme with the second version, which can accordingly export dll file.  So the property grid will be shown up with a

 particular theme.  How to solve this problem?

Sep 15, 2009 at 6:20 PM
Edited Sep 15, 2009 at 6:21 PM

I didn't try to integrate it, but IMHO it should work just fine.