Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: PropertyGrid error when opening collection

$
0
0
As soon as I click the "(Collection)" button to open a CollectionControlDialog, it will throw an exception.
It appears to be caused by having a List property inside of another List property.

Here is some code which will always throw a System.NullReferenceException.
If you initialise MyStringList via the constructor, it will throw a System.Reflection.TargetParameterCountException instead.
Removing the MyStringList property will stop all exceptions.
public MainWindow()
{
    InitializeComponent();
    PropertyGrid.SelectedObject = new MyContainerClass();
}
public class MyContainerClass
{
    public MyContainerClass()
    {
        MyClassList = new List<MyClass>();
        MyClassList.Add(new MyClass());
    }
    public List<MyClass> MyClassList { get; set; }
}
public class MyClass
{
    public List<string> MyStringList { get; set; }
}
The XAML for "PropertyGrid" is simply
<xctk:PropertyGrid x:Name="PropertyGrid" />
My Windows build version is 10586.420.

Viewing all articles
Browse latest Browse all 4964

Trending Articles