Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic how to disable the DefaultShape of the diagram (Read 3068 times)
newUser
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 5
Joined: Sep 4th, 2008
how to disable the DefaultShape of the diagram
Sep 8th, 2008 at 10:48am
Print Post  
sir,thanx for solving my previous problem.I want to know how to make the defaultShape property of diagram to null....Diagram..Behavior = Behavior.DoNothing does not create any shape bt at the same time i can't draw links for existing nodes....i want that after d node created with any selected shape as DefaultShape...the DefaultShape property become null...i.e. user is nt able to draw the shape without selecting a shape. i did ,diagramContainer.defaultShape=null; bt this throws an error...plz help me out

thanx n Regards
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: how to disable the DefaultShape of the diagram
Reply #1 - Sep 8th, 2008 at 11:54am
Print Post  
Set DiagramView.Behavior = DrawLinks and the user will be able to draw links between existing nodes but not to create new nodes.

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


I love YaBB 1G - SP1!

Posts: 5
Joined: Sep 4th, 2008
Re: how to disable the DefaultShape of the diagram
Reply #2 - Sep 9th, 2008 at 6:01am
Print Post  
Thanks......ealier i'd used that n it didn't work bt nw it's working absolutely fine....  :)
  
Back to top
 
IP Logged
 
newUser
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 5
Joined: Sep 4th, 2008
Re: how to disable the DefaultShape of the diagram
Reply #3 - Sep 10th, 2008 at 9:08am
Print Post  
Hi,I am trying to draw a canvas on the diagram area.I wrote :-
diagram .Behavior = Behavior.Custom;
diagram .CustomNodeType = typeof(Canvas);

when a toolbox item canvas is clicked.It allows me to draw a canvas,bt when nt selected the canvas is nt visible n furthur if i try to add another UIElement like button by same method as above:-
diagram .CustomNodeType = typeof(Button);

the canvas doesn't allow the button to b created in it,i.e. i can't add the button as a child of the canvas.
If i drag n drop the button over the canvas it adds the button as a child:-

void thisCanvas_Drop(object sender, DragEventArgs e)
       {
           Canvas currentCanvas = sender as Canvas;
           Button btn = new Button();
           btn.Height = 20;
           btn.Width = 100;
           btn.Content = "Button1";
           currentNodeCreated = btn as UIElement;
           currentCanvas.Children.Add(currentNodeCreated);
       }


bt it does not allow the child button to modify,i.e text/height/widht can't b changed.
can u help me out?
Thanks n Regards
Kavita.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: how to disable the DefaultShape of the diagram
Reply #4 - Sep 11th, 2008 at 8:12am
Print Post  
Hi,

The canvas is not visible because by default it has a transparent background. You could set the Background property from the NodeCreated event handler.

Code
Select All
DiagramNodeAdapter dna = e.Node as DiagramNodeAdapter;
if (dna != null)
{
	Canvas canvas = dna.UIElement as Canvas;
	if (canvas != null)
		canvas.Background = Brushes.LightGreen;
}
 



The Diagram control lets you select and resize only its child objects; this won't work with child objects you add to the canvas.

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