Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Error when copy node ! (Read 6720 times)
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Error when copy node !
Mar 24th, 2011 at 12:04pm
Print Post  
System.Windows.Markup.XamlParseException was unhandled
  Message='Cannot set unknown member '{http://schemas.microsoft.com/expression/2010/drawing}ShapeImplementation.ShouldF...'.' Line number '1' and line position '708'.
  Source=PresentationFramework
  LineNumber=1
  LinePosition=708
  StackTrace:
      at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
      at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
      at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, Boolean skipJournaledProperties, Uri baseUri)
      at System.Windows.Markup.XamlReader.Load(XamlReader xamlReader, ParserContext parserContext)
      at System.Windows.Markup.XamlReader.Load(XmlReader reader, ParserContext parserContext, XamlParseMode parseMode)
      at System.Windows.Markup.XamlReader.Load(XmlReader reader)
      at MindFusion.Diagramming.Wpf.DiagramNodeAdapter.xb346c580af9eaf57(UIElement x4bbc2c453c470189)
      at MindFusion.Diagramming.Wpf.DiagramNodeAdapter..ctor(DiagramNodeAdapter prototype)
      at MindFusion.Diagramming.Wpf.DiagramNodeAdapter.Clone(Boolean clipboard)
      at MindFusion.Diagramming.Wpf.Diagram.CopySelection(Diagram source, Boolean unconnectedLinks, Boolean copyGroups)
      at MindFusion.Diagramming.Wpf.Diagram.CopyToClipboard(Boolean persist, Boolean groups)
      at MindFusion.Diagramming.Wpf.Diagram.xf89f70209334cdd5(Object xe0292b9ed559da7d, ExecutedRoutedEventArgs xce8d8c7e3c2c2426)
      at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
      at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
      at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
      at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
      at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
      at System.Windows.UIElement.OnExecutedThunk(Object sender, ExecutedRoutedEventArgs e)
      at System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
      at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
      at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
      at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
      at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
      at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
      at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
      at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
      at System.Windows.Input.RoutedCommand.ExecuteCore(Object parameter, IInputElement target, Boolean userInitiated)
      at System.Windows.Input.CommandManager.TranslateInput(IInputElement targetElement, InputEventArgs inputEventArgs)
      at System.Windows.UIElement.OnKeyDownThunk(Object sender, KeyEventArgs e)
      at System.Windows.Input.KeyEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
      at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
      at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
      at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
      at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
      at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
      at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
      at System.Windows.Input.InputManager.ProcessStagingArea()
  
Back to top
 
IP Logged
 
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: Error when copy node !
Reply #1 - Mar 24th, 2011 at 12:04pm
Print Post  
Sorry i have to slit error in 2 due forum limitation:

at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
      at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
      at System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey)
      at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
      at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers)
      at System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
      at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
      at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
      at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
      at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
      at System.Windows.Interop.HwndSource.OnPreprocessMessageThunk(MSG& msg, Boolean& handled)
      at System.Windows.Interop.HwndSource.WeakEventPreprocessMessage.OnPreprocessMessage
(MSG& msg, Boolean& handled)
      at System.Windows.Interop.ThreadMessageEventHandler.Invoke(MSG& msg, Boolean& handled)
      at System.Windows.Interop.ComponentDispatcherThread.RaiseThreadMessage(MSG& msg)
      at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
      at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
      at System.Windows.Threading.Dispatcher.Run()
      at System.Windows.Application.RunDispatcher(Object ignore)
      at System.Windows.Application.RunInternal(Window window)
      at System.Windows.Application.Run(Window window)
      at System.Windows.Application.Run()
      at Project.App.Main() in C:\MainWindow\obj\x86\Debug\App.g.cs:line 0
      at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
      at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
      at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
      at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.Xaml.XamlObjectWriterException
      Message='Cannot set unknown member '{http://schemas.microsoft.com/expression/2010/drawing}ShapeImplementation.ShouldF...'.' Line number '1' and line position '708'.
      Source=System.Xaml
      LineNumber=1
      LinePosition=708
      StackTrace:
           at System.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property)
           at System.Xaml.XamlWriter.WriteNode(XamlReader reader)
           at System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector)
           at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
      InnerException:
  
Back to top
 
IP Logged
 
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: Error when copy node !
Reply #2 - Mar 24th, 2011 at 12:06pm
Print Post  
I think is error on CopyHostedControl

I cna create my node, can save my driagram and load again without any error.
One of my custom nodes use shape provided by BLEND.
WHen i try copy that node, have this error.
Hoppe this can e fixed ASAP.
Bets regards.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Error when copy node !
Reply #3 - Mar 24th, 2011 at 6:27pm
Print Post  
Is there a "ShouldForceResetRenderGeometry" property set anywhere in your Xaml?
  
Back to top
 
IP Logged
 
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: Error when copy node !
Reply #4 - Mar 24th, 2011 at 7:56pm
Print Post  
No
And no idea what is, and if neded no idea how need be config.
I google and not found nothing. Embarrassed
If needed i can send complete zip code example, just letmeknow.
The shape i used is ARC, from blend.
Anyway is starnge can save and lod but not copy and pase, so is a specific problem of copy.
« Last Edit: Mar 24th, 2011 at 9:20pm by PDM. »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Error when copy node !
Reply #5 - Mar 25th, 2011 at 8:30am
Print Post  
The idea is that controls are first cloned using XamlWriter and XamlReader to get as much data as possible copied automatically. Then CopyHostedControl is raised to let you copy things that are not handled by XamlWriter/Reader, such as event handlers and styles.

Now if XamlReader can throw such exceptions, we'll have to redesign the whole process of copying hosted controls. Meanwhile try to create your control using different shapes in Blend, e.g. Bezier curves instead of Arcs, or using hand-crafted Xaml if this happens because of some attributes added only by Blend.
  
Back to top
 
IP Logged
 
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: Error when copy node !
Reply #6 - Mar 25th, 2011 at 12:18pm
Print Post  
This is really bad news, i really cant remplace ARC.  Undecided is used for a complex dynamic component cant be remplaced.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Error when copy node !
Reply #7 - Mar 30th, 2011 at 3:06pm
Print Post  
Please try this version:
https://mindfusion.eu/_beta/wpfdiag252.zip

Now the recommended way to copy hosted controls is to implement the ICloneable interface if it's your own user control, and use the CopyHostedControl event only for third party controls. If the hosted element is not an ICloneable, WpfDiagram will try to deep-copy it via XamlWriter/XamlReader, and if that fails it just creates a new instance of the hosted control's type through reflection.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: Error when copy node !
Reply #8 - Apr 5th, 2011 at 5:32am
Print Post  
Please can explain how use iclobable, like always i request with some clete sample code?
Bets regards.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Error when copy node !
Reply #9 - Apr 5th, 2011 at 7:49am
Print Post  
Here's an example:
Code
Select All
public partial class MyButton : UserControl, ICloneable
{
	public object Clone()
	{
		var clone = new MyButton();
		clone.Text = this.Text;
		return clone;
	}
	...
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: Error when copy node !
Reply #10 - Apr 8th, 2011 at 1:52pm
Print Post  
This is how i created the ARC:


var ARC = new MyARC();

var node = new DiagramNodeAdapter(form, ARC);

node.Bounds = new Rect(e.MousePosition, new Size(110, 110));

form.Nodes.Add(node);

node.Selected = true;

node.Constraints.MinWidth = 100;

node.Constraints.MinHeight = 100;

ARC.EndAngle = 90;



Now with hosted copy is how i try copy and not work:



if (e.Source is MyARC)


{


var destNode = Diagram.GetDiagramItem(e.Destination) as DiagramNodeAdapter;


var ARC = new DialCtrl();


Dial.EndAngle = ((MyARC))e.Source).EndAngle;







destNode.Control = ARC;


}



My component is already edited:
public partial class MyARC : UserControl, ISerializable, ICloneable


  public object Clone()
       {
           var clone = new MyARC();
           clone.EndAngle = this.EndAngle;
         
        
           return clone;
       }


I asumed hosted copy no is uded more, but how copy now?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Error when copy node !
Reply #11 - Apr 8th, 2011 at 2:19pm
Print Post  
You don't have to handle CopyHostedControl event now if you have implemented the Clone method, but you will still need to handle the serialization events for copy/paste to work.
  
Back to top
 
IP Logged
 
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: Error when copy node !
Reply #12 - Apr 8th, 2011 at 2:53pm
Print Post  
Awesome is finally working !
THK !
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint