I have created an object called Project that has different properties (strings and some custom objects), I have bound text fields to these properties to get user input. I have created a method that outputs this object to an XML file. However when I import this XML file back into memory the text fields do not become populated with the text or list views of some custom objects that inherit from ObservableCollection do not have any text. The XML does load properly since if I enter text into the empty fields it updates the property and I can export an XML file with the new values.
To load the xml I use the following code
public void LoadXML()
{
OpenFileDialog fileDialog = new OpenFileDialog();
fileDialog.Title = "Load XML File";
fileDialog.Filter = "XML Files|*.xml";
DialogResult result = fileDialog.ShowDialog();
if (result.ToString().Equals("OK"))
{
string filePath = fileDialog.FileName.ToString();
XmlSerializer serializer = new XmlSerializer(typeof(Project));
TextReader textReader = new StreamReader(filePath);
newProject = (Project)serializer.Deserialize(textReader);
textReader.Close();
}
}
Any suggestions would be welcomed, thanks.