Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion FormSerialisor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ private static void AddChildControls(XmlTextWriter xmlSerialisedForm, Control c)
{
xmlSerialisedForm.WriteElementString("Text", ((DateTimePicker)childCtrl).Text);
}

else if (childCtrl is RadioButton)
{
xmlSerialisedForm.WriteElementString("RadioButton", ((RadioButton)childCtrl).Checked.ToString());
}
// this next line was taken from http://stackoverflow.com/questions/391888/how-to-get-the-real-value-of-the-visible-property
// which dicusses the problem of child controls claiming to have Visible=false even when they haven't, based on the parent
// having Visible=true
Expand Down Expand Up @@ -161,6 +166,10 @@ private static void SetControlProperties(Control currentCtrl, XmlNode n)
case "System.Windows.Forms.DateTimePicker":
((System.Windows.Forms.DateTimePicker)ctrlToSet).Text = n["Text"].InnerText;
break;

case "System.Windows.Forms.RadioButton":
((System.Windows.Forms.RadioButton)ctrlToSet).Checked = Convert.ToBoolean(n["RadioButton"].InnerText);
break;;
}
ctrlToSet.Visible = Convert.ToBoolean(n["Visible"].InnerText);
// if n has any children that are controls, deserialise them as well
Expand Down Expand Up @@ -200,4 +209,4 @@ private static Control GetImmediateChildControl(Control[] ctrl, Control currentC
}

}
}
}