I am new to WPF. I have Created some user Controls with some basic events, then loaded these user controls at runtime in a listview. Then I dragged and dropped these user controls on a container (Canvas).
Then I tried to store it using the XamlWriter.Save function and to reopen it with XamlReader.Load. So far so good.
The problem is that I am not getting the events when I reopened the stored XAML.
I have reads in Microsoft blogs that storing events using XamlWriter.Save is not possible. My goal is to get the events when I restore the XAML again. How can I do this?
If serializing to and from xaml is not actually a requirement then you may want to change your strategy. Normally in WPF you want to avoid lists of controls and instead have a list of data, then template that data so that it shows up as different controls. Try binding your ListView to a collection of objects that simply represent data, and then create templates to render your controls. Your problem might be similar to the one in this question: WPF Custom control for receipt preview