Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Removing a Node from a Diagram (Read 4327 times)
EricGiles
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Mar 19th, 2009
Removing a Node from a Diagram
Mar 19th, 2009 at 5:53am
Print Post  
When calling the Remove method of the Nodes collection of the diagram (d)

d.Nodes.Remove(node);

The call works correctly, the node is removed from the diagram however as soon as I move the mouse over the diagram, the Silverlight object crashes with an unhandled exception.

The specific node I was removing was created using the CreateShapeNode method of the diagram's Factory.

ShapeNode shape2 = d.Factory.CreateShapeNode(new Rect(20, 20, 50, 50), Shapes.Actor);


Stack Trace
----------------
   at MindFusion.Diagramming.Silverlight.DiagramNode.x3d2277a3b84b3698(DiagramNode x8d5eca828b99d00c)
   at MindFusion.Diagramming.Silverlight.Diagram.x92bb101faf551658(DiagramNode xda5bf54deb817e37)
   at MindFusion.Diagramming.Silverlight.Diagram.x2c5d1da1234c3a6a(Object xe0292b9ed559da7d, MouseEventArgs xfbf34718e704c6bc)
   at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)

This only happens when I try to handle the KeyDown event of the diagram and remove the node from within it. If I perform exactly the same action within say  button click event handler, all is well.

I think it must be an issue with the Silverlight plugin itself and an unsafe call into the nodes collection. ????

Looking forward to hearing your thoughts on how this might be handled.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Removing a Node from a Diagram
Reply #1 - Mar 19th, 2009 at 11:58am
Print Post  
Hi,

Could you check if this works with v1.0.2:
https://mindfusion.eu/_beta/DiagramLite102.zip

Thanks,
Stoyan
  
Back to top
 
IP Logged
 
EricGiles
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Mar 19th, 2009
Re: Removing a Node from a Diagram
Reply #2 - Mar 20th, 2009 at 10:39am
Print Post  
Stoyo,

I tried everything to recreate the problem using version 1.0.2 without success. Works a treat!

The only other thing I just noticed with version 1.0.2 beta is that the background of the diagram using a LinearGradientBrush is not showing the colour. (The background of the drawing remains white) where this worked as expected with the previous version. I have inserted the xaml below.

<DiagramLite:Diagram x:Name="d"  LinkStyle="Bezier" Grid.ColumnSpan="1" Grid.RowSpan="1" Grid.Row="1" LayoutUpdated="d_LayoutUpdated" MinWidth="500" MinHeight="500" KeyDown="d_KeyDown">
           <DiagramLite:Diagram.Background>
           <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
           <GradientStop Color="#FF000000"/>
           <GradientStop Color="#FFC82D2D" Offset="1"/>
           </LinearGradientBrush>
           </DiagramLite:Diagram.Background>
           </DiagramLite:Diagram>

Thanks,

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Removing a Node from a Diagram
Reply #3 - Mar 20th, 2009 at 10:48am
Print Post  
Hi Eric,

Seems we have renamed this to BackBrush for compatibility with our ASP.NET component. Could you try setting <DiagramLite:Diagram.BackBrush>?

Thanks,
Stoyan
  
Back to top
 
IP Logged
 
EricGiles
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Mar 19th, 2009
Re: Removing a Node from a Diagram
Reply #4 - Mar 20th, 2009 at 12:34pm
Print Post  
No worries. I changed it and it was fine.

In my opinion, you would be better to support both if at all possible as it makes your diagram control behave differently to all other Silverlight controls I have used.

So, you could expose the BackBrush property as you do now and reuse the property in the setting of the 'standard' Background dependency property.

Thanks for your help,

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Removing a Node from a Diagram
Reply #5 - Mar 20th, 2009 at 3:38pm
Print Post  
Perhaps we should build the NetDiagram's version of the control with a property named BackBrush and the standalone version with a property called Background 8) Our developers will decide for the v1.0.3 release.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint