I am trying to implement Load/Save annotations (complex children, not ink strokes, like an editable text box) of an InkCanvas and when I use XamlReader.Load I get an exception where it is trying to load something into the dictionary that is already there. I believe I need to access the dictionary and either check to see if something is already there or just clear it out.
My question is, how can I access the resource dictionary programmatically or is there a better way to handle this?
All FrameworkElement derived classes include a Resources property you can use to access the resource dictionary for that element. You can also directly access Application.Resources if the resource is defined at the Application level.