Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic SerializeTag Event Not Firing (Read 4005 times)
integragreg
YaBB Newbies
*
Offline



Posts: 40
Location: Tennessee
Joined: Jan 26th, 2009
SerializeTag Event Not Firing
Feb 9th, 2009 at 8:21pm
Print Post  
We're trying to handle the SerializeTag event on a Wpf Diagram so that we can perform custom serialization of an object that is assigned to the diagram's Tag property. But the SerializeTag event is not firing. Here's how we're handling the event:

[code]
private void MenuItem_Click1(object sender, RoutedEventArgs e)


{



currentDiagram.SerializeTag += new SerializeTagEventHandler(currentDiagram_SerializeTag);



currentDiagram.SaveToXml(@"c:\Test.xml");


}



void currentDiagram_SerializeTag(object sender, SerializeTagEventArgs e)


{



e.Handled = true;



DiagramProperties dp = e.Tag as DiagramProperties;



if (dp != null)



{




string xml = dp.SerializeState();




XmlNode repNode = e.Context.XmlDocument.CreateTextNode(xml);




e.Representation.AppendChild(repNode);



}


}
[/code]

DiagramProperties is an instance of a custom class that stores metadata about our diagram.

Thanks,

Greg
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SerializeTag Event Not Firing
Reply #1 - Feb 10th, 2009 at 9:56am
Print Post  
Seems Diagram inherits the Tag property from FrameworkElement, and we haven't implemented serialization for it at all. We'll do that for the 2.1.1 release.

Stoyan
  
Back to top
 
IP Logged
 
integragreg
YaBB Newbies
*
Offline



Posts: 40
Location: Tennessee
Joined: Jan 26th, 2009
Re: SerializeTag Event Not Firing
Reply #2 - Feb 10th, 2009 at 2:33pm
Print Post  
Great. Thanks. This would be a very helpful for serializing diagram metadata.
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SerializeTag Event Not Firing
Reply #3 - Feb 10th, 2009 at 2:34pm
Print Post  
Should work here, if you care to try the beta version:
https://mindfusion.eu/_beta/wpfdiag211.zip
  
Back to top
 
IP Logged
 
integragreg
YaBB Newbies
*
Offline



Posts: 40
Location: Tennessee
Joined: Jan 26th, 2009
Re: SerializeTag Event Not Firing
Reply #4 - Feb 10th, 2009 at 2:35pm
Print Post  
Can you also get this feature into the Silverlight diagram component?
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SerializeTag Event Not Firing
Reply #5 - Feb 10th, 2009 at 2:46pm
Print Post  
of course 8)
  
Back to top
 
IP Logged
 
integragreg
YaBB Newbies
*
Offline



Posts: 40
Location: Tennessee
Joined: Jan 26th, 2009
Re: SerializeTag Event Not Firing
Reply #6 - Feb 11th, 2009 at 8:07pm
Print Post  
Stoyo,

We're using the beta now, and the Serialize/DeserializeTag events are firing correctly for the diagram's tag. However, it doesn't fire for custom UIElements that have tags.
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SerializeTag Event Not Firing
Reply #7 - Feb 12th, 2009 at 8:24am
Print Post  
Are you settings the Tag of the hosted UIElement, or the DiagramNodeAdapter.Tag? UIElement.Tag might be serialized too if the tag type is ISerializable, but I haven't tried it - that won't raise SerializeTag event for sure, but will rely on the .NET Xaml serializers to save and load tags.

Stoyan
  
Back to top
 
IP Logged
 
integragreg
YaBB Newbies
*
Offline



Posts: 40
Location: Tennessee
Joined: Jan 26th, 2009
Re: SerializeTag Event Not Firing
Reply #8 - Feb 12th, 2009 at 2:45pm
Print Post  
Stoyan,

I think we have a workaround for this issue. We're now serializing the tag of the containing DiagramNodeAdapter instead of our custom UIElement. Works like a charm.

Thanks!
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint