Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) some queries about wpfDiagram (Read 6783 times)
shikha_garhewal
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: Feb 11th, 2009
some queries about wpfDiagram
Feb 14th, 2009 at 11:07am
Print Post  
Hi,

Please suggest on how to achieve following:

1. How to bind collection of items to the wpfDiagram? Is there any sample program available?

2.We want to lock the nodes/links movement

3.How to prevent self-loops and more than one connection/link between the nodes?

4.Is there any kind of support for Transparent/Invisible nodes?

5.Can we dynamically change background color of nodes?








Thanks
« Last Edit: Feb 14th, 2009 at 2:43pm by shikha_garhewal »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: some queries about wpfDiagram
Reply #1 - Feb 15th, 2009 at 8:23am
Print Post  
Hi,

1. Databinding is not supported yet.

2. item.Locked = true (also disables selection) or node.EnabledHandles = None (selection still works).

3. AllowSelfLoops and AllowLinksRepeat.

4. DiagramItem.Visble lets you hide or show items. If ShapeNode.Transparent == true, only the text and image are left visible.

5. Set the Brush property.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
anurodhora
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 103
Joined: Jan 19th, 2009
Re: some queries about wpfDiagram
Reply #2 - Mar 6th, 2009 at 7:17am
Print Post  
Hi,

On lock button click we placed following code to lock diagram elements.
foreach (ShapeNode node in diagram.Nodes)
           {
               if (node.EnabledHandles != AdjustmentHandles.None)
               {
                   node.EnabledHandles = AdjustmentHandles.None;
               }
}

but is there any other elegant way to lock/unlock movement of diagram elements.

Thanks,
Anurodh
  
Back to top
 
IP Logged
 
anurodhora
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 103
Joined: Jan 19th, 2009
Re: some queries about wpfDiagram
Reply #3 - Mar 10th, 2009 at 12:18pm
Print Post  
Any updates on above.

Also we want that the selection still works in lock mode but the cursor should not be displayed as movement cursor (4 directional arrow) as it may not make sense to present user with movement cursor though the node can not be moved.

the cursor in this case should be default arrow one.

Thanks,
Anurodh
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: some queries about wpfDiagram
Reply #4 - Mar 10th, 2009 at 12:41pm
Print Post  
There are many other ways to do that. For example handle the NodeStartModifying and LinkStartModifying validation events to stop modification of some items, or create a custom BehaviorBase- derived class and assign it to DiagramCustomBehavior.
  
Back to top
 
IP Logged
 
anurodhora
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 103
Joined: Jan 19th, 2009
Re: some queries about wpfDiagram
Reply #5 - Mar 10th, 2009 at 1:07pm
Print Post  
Thanks for the reply.

Please suggest about cursor thing.

Also we want that the selection still works in lock mode but the cursor should not be displayed as movement cursor (4 directional arrow) as it may not make sense to present user with movement cursor though the node can not be moved. 

the cursor in this case should be default arrow one.

Thanks,
Anurodh
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: some queries about wpfDiagram
Reply #6 - Mar 10th, 2009 at 3:31pm
Print Post  
How exactly have you implemented your locked nodes, are you still using node.EnabledHandles?
  
Back to top
 
IP Logged
 
anurodhora
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 103
Joined: Jan 19th, 2009
Re: some queries about wpfDiagram
Reply #7 - Mar 12th, 2009 at 5:29am
Print Post  
Yes,

Initially the node handle style was
node.EnabledHandles = AdjustmentHandles.Move;

then we locked all the nodes movement using:
node.EnabledHandles = AdjustmentHandles.None;

ok, now i got the problem.
As, the movement of the all the nodes are locked then the movement cursor (4 directional arrow) on the node does not make sense. So if you select one node which has AdjustmentHandles.None then it works fine that is we do not get the movement cursor only arrow cursor appears. But the problem comes
when more than one locked nodes are selected then the movement cursor appears and which should not as the nodes are locked and cant be moved.

I think it can be considered as a bug.

Thanks,
Anurodh
  
Back to top
 
IP Logged
 
anurodhora
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 103
Joined: Jan 19th, 2009
Re: some queries about wpfDiagram
Reply #8 - Mar 16th, 2009 at 1:22pm
Print Post  
Hi,

Now, i have moved to the NodeStartModifying handling approach, its working fine, but one issue is how to change the cursor, see following code:

Code
Select All
void diagram_NodeStartModifying(object sender, NodeValidationEventArgs e)
	  {
		if (lockNodeMovement)
		{
		    e.CancelDrag();
		    diagram.Cursor = Cursors.Arrow;
		}
		else
		{
		    diagram.Cursor = Cursors.ScrollAll;
		}
	  }
 



why we are not seeing the cursor changes on diagram. Is dispatcher needed?

Thanks,
Anurodh

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: some queries about wpfDiagram
Reply #9 - Mar 16th, 2009 at 1:32pm
Print Post  
Hi,

Try setting the Diagram.OverrideCursor property.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
anurodhora
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 103
Joined: Jan 19th, 2009
Re: some queries about wpfDiagram
Reply #10 - Mar 17th, 2009 at 2:18pm
Print Post  
Yes, it is now working fine.

But on playing with it i found a new issue when multiple nodes are selected locking does not work for below code

Code
Select All
void diagram_NodeStartModifying(object sender, NodeValidationEventArgs e)
  {
if (lockNodeMovement)
{
    e.CancelDrag();
    diagram.OverrideCursor= Cursors.Arrow;
}
else
{
   diagram.OverrideCursor = null;
}
}
 



Can you suggest me what to do in order to lock node movement for both single selection and multiple selection.

Thanks,
Anurodh
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: some queries about wpfDiagram
Reply #11 - Mar 17th, 2009 at 3:05pm
Print Post  
Do the same from the SelectionMoving handler.
  
Back to top
 
IP Logged
 
anurodhora
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 103
Joined: Jan 19th, 2009
Re: some queries about wpfDiagram
Reply #12 - Mar 18th, 2009 at 4:50am
Print Post  
Thanks working now.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint