Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Drawcontrol Behaviour (Read 1983 times)
zoozoo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Jun 24th, 2009
Drawcontrol Behaviour
Jun 24th, 2009 at 2:33am
Print Post  
Hi,

Please can anyone explain the way draw control behaviour and control node has to be used.
I am trying to create a diagram with controlnodes but everytime i try creating the controlnode it throws an exception

code snippet

diagram.Behavior = Behavior.DrawControls;
diagram.DefaultControlType = typeof( System.Windows.Controls.TextBox) ;
           
TextBox tb = new TextBox();
tb.Text = "test";

ControlNode cntrl = new ControlNode(diagram, tb);

var layout = new MindFusion.Diagramming.Silverlight.Layout.TreeLayout();
layout.Arrange(diagram);

thanks in advance
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Drawcontrol Behaviour
Reply #1 - Jun 24th, 2009 at 6:21am
Print Post  
Hi,

I could not get this code to crash, nor calling layout.Arrange crashed after drawing some nodes. Could you copy the stack trace here?

Stoyan
  
Back to top
 
IP Logged
 
zoozoo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Jun 24th, 2009
Re: Drawcontrol Behaviour
Reply #2 - Jun 25th, 2009 at 4:35am
Print Post  
Sorry for replying late

heres the stack trace

System.NullReferenceException was unhandled by user code
  Message="Object reference not set to an instance of an object."
  StackTrace:
      at MindFusion.Diagramming.Silverlight.DiagramNode.AddExpandButton()
      at MindFusion.Diagramming.Silverlight.DiagramNode.set_Expandable(Boolean value)
      at MindFusion.Diagramming.Silverlight.DiagramNode..ctor(Diagram parent)
      at MindFusion.Diagramming.Silverlight.ControlNode..ctor(Diagram parent, FrameworkElement control)
      at TreeLayout.Page.OnPageLoaded(Object sender, RoutedEventArgs e)
      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)
  InnerException:

thanks in advance.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Drawcontrol Behaviour
Reply #3 - Jun 25th, 2009 at 6:21am
Print Post  
Seems that's a bug in adding the +/- icon from the ControlNode constructor when Diagram.NodesExpandable is set. As a workaround, set NodesExpandable = false, and for each node set Expandable = true after adding it:

Code
Select All
diagram.NodesExpandable = false;
for (int i = 0; i < 10; ++i)
{
	var node = new ControlNode(diagram, new TextBox());
	diagram.Nodes.Add(node);
	node.Expandable = true;
}
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint