Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic PasteSelection error under Silverlight 3 (Read 4852 times)
buchatsky
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Mar 2nd, 2010
PasteSelection error under Silverlight 3
Mar 2nd, 2010 at 10:37am
Print Post  
Hi All,

I'm trying a simple copy/paste operation like this:

Code
Select All
SelectionCopy selCopy = null;
...
selCopy = selDiagram.CopySelection(true);
...
if (selCopy != null)
  selDiagram.PasteSelection(selCopy, 10, 10); 


and get the following error:
Code: 1001   
Category: ParserError      
Message: AG_E_UNKNOWN_ERROR    
File:      
Line: 3    
Position: 117    
It doesn't matter whether I paste selection into the same or another diagram, in IE or FireFox.
MindFusion.Diagramming.Silverlight.dll version 1.3.0.21947
Silverlight 3 version 3.0.40818.0
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PasteSelection error under Silverlight 3
Reply #1 - Mar 2nd, 2010 at 10:54am
Print Post  
Hi there,

This looks like an error in the Xaml file, but it might also happen if an object created by the XamlParser throws an exception. Are you calling that code from the page class constructor?

Stoyan
  
Back to top
 
IP Logged
 
buchatsky
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Mar 2nd, 2010
Re: PasteSelection error under Silverlight 3
Reply #2 - Mar 3rd, 2010 at 9:27am
Print Post  
No, I call both methods in response to button clicks that I added to one of your samples, Effects.csproj
Interesting! It works with diagram links, but not with nodes. And, in case with links, Paste works only once, the second time it throws "Element is already the child of another element". And it does not work with already pasted links
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PasteSelection error under Silverlight 3
Reply #3 - Mar 3rd, 2010 at 11:40am
Print Post  
This turned out to be an effect of a known bug which happens because the Silverlight DoubleCollection objects cannot be shared, but the control does not clone them correctly when pasting items:
http://mindfusion.eu/Forum/YaBB.pl?board=diaglite_disc;action=display;num=126638...

As a workaround for both problems, do this after pasting:

Code
Select All
private SelectionCopy sc;
private void OnPaste(object sender, RoutedEventArgs e)
{
	diagram.PasteSelection(sc, 10, 10);
	foreach (DiagramItem item in diagram.Items)
		item.StrokeDashArray = new DoubleCollection();
	sc = diagram.CopySelection(true);
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PasteSelection error under Silverlight 3
Reply #4 - Mar 3rd, 2010 at 4:13pm
Print Post  
Hi,

With this version you won't have to clone the dash array:
https://mindfusion.eu/_beta/diaglite14_sp.zip

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
buchatsky
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Mar 2nd, 2010
Re: PasteSelection error under Silverlight 3
Reply #5 - Mar 11th, 2010 at 1:00pm
Print Post  
Thank you, now it works!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint