Is it possible to do? I am having trouble with finding a way of saving WPF Button's properties using BinaryWriter for a text-based game. The thing is I need it to save button's button1.Content, button1.Click and button1.ToolTip so I can load it back using BinaryReader.
You can save entire Button
, which will be persisted with all its properties.
And you can then de-serialize it back. We can the services provided by using System.Windows.Markup
namespace.
Serialize Button
with name Btn
string btnData = XamlWriter.Save(Btn);
Deserialize it back
Button btn = (Button) XamlReader.Parse(btnData);