Hi,
I have a nested structure of classes assigned to a PropertyGrid.
When i edit a collection field, the collection editor opens, fine.
Now when i change a (string) value in the collection editor and press the OK button an exception is thrown, from the code below.
The exception
2013-09-20 08:48:33,348 [9] FATAL Twister.App - CurrentDomain_UnhandledException - Unhandled exception : System.NotSupportedException: Collection was of a fixed size.
at System.Array.System.Collections.IList.Add(Object value)
at Xceed.Wpf.Toolkit.CollectionControl.PersistChanges()
The code where it is thrown
CollectionControl.c
public void PersistChanges()
{
IList list = ComputeItemsSource();
if( list == null )
return;
//the easiest way to persist changes to the source is to just clear the source list and then add all items to it.
list.Clear();
foreach( var item in Items )
{
list.Add( item ); <-------------------------- EXCEPTION
}
}
My data structure looks like this
// VectorType --- Data(list/collection of DataType)
// --- ID (string)
// DataType --- class(ExpectedKeywordSectionType)
// --- class(InputKeywordSectionType)
// --- Objective (string)
An VectorType instance is assigned to the SelectedObject of my PropertyGrid, and i'm trying to edit the Objective (in the collectioneditor)
In the debugger i saw that the 'list' object has property 'IsFixedSize = true', maybe a check should be added here?
But what is more important for me; how could i prevent this from happening? Is it my data structure that is not supported or is there a workaround for this?
Attached is a debugger screenshot with relevant values just before the point the exception is thrown.
Thanks in advance,
Ruud
I have a nested structure of classes assigned to a PropertyGrid.
When i edit a collection field, the collection editor opens, fine.
Now when i change a (string) value in the collection editor and press the OK button an exception is thrown, from the code below.
The exception
2013-09-20 08:48:33,348 [9] FATAL Twister.App - CurrentDomain_UnhandledException - Unhandled exception : System.NotSupportedException: Collection was of a fixed size.
at System.Array.System.Collections.IList.Add(Object value)
at Xceed.Wpf.Toolkit.CollectionControl.PersistChanges()
The code where it is thrown
CollectionControl.c
public void PersistChanges()
{
IList list = ComputeItemsSource();
if( list == null )
return;
//the easiest way to persist changes to the source is to just clear the source list and then add all items to it.
list.Clear();
foreach( var item in Items )
{
list.Add( item ); <-------------------------- EXCEPTION
}
}
My data structure looks like this
// VectorType --- Data(list/collection of DataType)
// --- ID (string)
// DataType --- class(ExpectedKeywordSectionType)
// --- class(InputKeywordSectionType)
// --- Objective (string)
An VectorType instance is assigned to the SelectedObject of my PropertyGrid, and i'm trying to edit the Objective (in the collectioneditor)
In the debugger i saw that the 'list' object has property 'IsFixedSize = true', maybe a check should be added here?
But what is more important for me; how could i prevent this from happening? Is it my data structure that is not supported or is there a workaround for this?
Attached is a debugger screenshot with relevant values just before the point the exception is thrown.
Thanks in advance,
Ruud