Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic XamlParseException in diagram.LoadFromXml() (Read 4468 times)
JasonB
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: Jun 5th, 2008
XamlParseException in diagram.LoadFromXml()
Jul 14th, 2008 at 8:15pm
Print Post  
Message: 'RoutingOptions' property is read-only and cannot be set from markup. Line '1' Position '1551'.


The save is as follows:

     DiagramState diagramState = new DiagramState();
           XmlDocument doc = new XmlDocument();
           diagram.SaveToXml(doc);

           StringWriter stringWriter = new StringWriter();
           XmlTextWriter xmlWriter = new XmlTextWriter(stringWriter);
           doc.WriteTo(xmlWriter);

           diagramState.Diagram = stringWriter.ToString();
      
           State.Data = diagramState;

and load as follows:

           DiagramState diagramState = (DiagramState)State.Data;

           XmlDocument doc = new XmlDocument();
           doc.LoadXml(diagramState.Diagram);
           diagram.LoadFromXml(doc);

error thrown at line:

diagram.LoadFromXml(doc);


but stack trace just has:    at System.Windows.Markup.XamlReaderHelper.ThrowExceptionWithLine(String message)

Inner exception is null.
  
Back to top
 
IP Logged
 
JasonB
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: Jun 5th, 2008
Re: XamlParseException in diagram.LoadFromXml()
Reply #1 - Jul 14th, 2008 at 8:18pm
Print Post  
I can see that when loading the XmlDocument InnerXml property is equal to a bunch of xml that does not fit here. the routing options section looks like this:



<DeviceDiagram.RoutingOptions><mfdw:RoutingOptions /></DeviceDiagram.RoutingOptions>


This repeats for a total of 3 times (I have 3 nodes on the diagram).
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: XamlParseException in diagram.LoadFromXml()
Reply #2 - Jul 15th, 2008 at 6:20am
Print Post  
Is DeviceDiagram a property of your custom nodes which points back to the Diagram object?

Stoyan
  
Back to top
 
IP Logged
 
JasonB
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: Jun 5th, 2008
Re: XamlParseException in diagram.LoadFromXml()
Reply #3 - Jul 15th, 2008 at 2:09pm
Print Post  
DeviceDiagram is a subtype of Diagram. It just adds some methods + 1 collection property.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: XamlParseException in diagram.LoadFromXml()
Reply #4 - Jul 15th, 2008 at 2:23pm
Print Post  
Are DeviceDiagram instances contained within your custom nodes?
  
Back to top
 
IP Logged
 
JasonB
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: Jun 5th, 2008
Re: XamlParseException in diagram.LoadFromXml()
Reply #5 - Jul 15th, 2008 at 3:46pm
Print Post  
Yes, they are. My custom nodes have a reference back to the diagram.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint