In order to control the serialization of a List<CustomObject>, I placed that list in a class, eg.:
public class SerializableCustomObjectList : IXmlSerializable
{
public List<CustomObject> CustomObjectList = new List<CustomObject>();
...
}
public class CustomObject {...}
, an instance of which is stored in the Application Settings. I have no problem with the serialization/deserialization. However, when I try to bind the public property, CustomObjectList, to a ListBox, nothing happens.
Here’s my code:
<ListBox Name="CustomObjectListBox">
<ListBox.ItemsSource>
<Binding Source="{x:Static p:Settings.Default}"
Path="SavedCustomObjects.CustomObjectList"/>
</ListBox.ItemsSource>
...
</ListBox>
where SavedCustomObjects is the instance of SerializableCustomObjectList in the Properties.Settings.Default.
Current behavior is that the ListBox Items.Count remains at zero (in the debugger), even when the SavedCustomObjects.CustomObjectList is populated.
There are a few things I can see: