Troubleshooting
Q. When I run my application, I get a XamlParseException. The inner exception is “An instance of type ‘Mindscape.WpfPropertyGrid.PropertyGrid’ was being created, and a valid license could not be granted for the type ‘Mindscape.WpfPropertyGrid.PropertyGrid’.”
A. If you receive this exception and you have a full licence or a trial licence which has not expired, check that your project contains a licences.licx file (in the Properties folder). This file should be automatically generated by the Visual Studio 2008 WPF designer when you add a PropertyGrid control either via the designer or the XAML editor. If Visual Studio has not generated this file, either: (a) drag a PropertyGrid from the toolbox onto the designer (and delete it again) to get Visual Studio to regenerate the licences.licx file; or (b) copy a licenses.licx file from one of the sample projects.
You will also receive this exception if you are using a trial licence which has expired.
Q. After installation, I don’t see a Mindscape tab in the Visual Studio 2008 toolbox.
This is an issue with the Visual Studio 2008 Toolbox Controls Installer. Use the normal Add Tab and Choose Items menu options to add the control to the toolbar, or if you prefer to work in XAML rather than the designer, just use Add Reference in your project. The PropertyGrid control assembly is located in the Mindscape folder under your Program Files directory and a link is provided in the Start menu.
Q. Visual Studio 2005 won’t open the Samples solution.
The samples are written for Visual Studio 2008, as this is the first version of Visual Studio where the WPF designer is supported. To run the samples on VS2005, you will need to create your own solution and projects, and copy the source files into those projects. Alternatively, download the free Express edition of Visual C#.
Q. When I edit a boolean or enum property I get a StackOverflowException.
A. This occurs because the change to the value is being endlessly echoed back and forth between the editor and the property. The usual cause is that the data object is raising the INotifyPropertyChanged.PropertyChanged event whenever the property is set, even if the value has not changed.
Modify your data object to raise PropertyChanged only if the new value is different from the old one.
Boolean and enum types are most likely to encounter this because the ComboBox control (the default editor for these types) tries to update its source whenever its selection changes, even if the actual value of the ComboBox control has not changed.
Q. When I host the PropertyGrid control in a Windows Form, I don’t see the property names.
A. Windows Forms does not correctly measure the property name column during the form constructor. The column is incorrectly given a width so narrow as to prevent any text being displayed.
Modify your Windows Forms code to set the SelectedObject or ItemsSource property in the Load event handler rather than in the constructor.
Q. My custom property editors don’t appear when I use the ItemsSource property.
A. Check that the property editor declaration does not include a DeclaringType. A DeclaringType means that the editor will be used only if the entry is a member property of that type. This is usually appropriate when editing objects, because it ensures that the editor is not inadvertently used for a property of the same name but different semantics, but it is not appropriate when binding to a collection because the elements are not member properties of a type.