Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) SendToBack and BringToFront (Read 11720 times)
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
SendToBack and BringToFront
Feb 8th, 2010 at 5:54am
Print Post  
Hi Stoyo

How one can move a node to back and front ?

Is their any functions available like SendToBack and BringToFront ? If they are not availble which release will support these functions ?

I know, by changing the Z-index one can bring the node to above another node .. but how to decide which Z-index value should be assinged.
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SendToBack and BringToFront
Reply #1 - Feb 8th, 2010 at 8:55am
Print Post  
Hi Rajesh,

Set ZIndex = 0 to bring the item back or ZIndex = diagram.Items.Count - 1 to bring it to the front.

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


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: SendToBack and BringToFront
Reply #2 - Mar 9th, 2010 at 5:58am
Print Post  
Hi Stoyo

In my observation, I found that when I set Z-Index = 0 for multiple items ( based on some condition) then newly added item get z-index value set to the position in the collection.

For eq. If I set Z-Index = 0 for first 5 nodes added in diagram, then 6th node added in the collection will get the Z-index value = 5.

When Z-Index order is for multiple items are same same then I think it considers the position in the collection to control the display (FYI : No item is child of any container item )

In above situation, I can't implement the suggestion proposed in you reply.

How I can do resolve this ?

When the ZLevelUp, ZLevelDown and ZTop, ZBottom function available in silverlight version ?

-Regards
Rajesh
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SendToBack and BringToFront
Reply #3 - Mar 9th, 2010 at 9:08am
Print Post  
Hi Rajesh,

ZIndex always corresponds to the position of an item within the diagram.Items collection. If you set ZIndex = 0 for some item with a greater index, the other items in the collection are shifted and also get new ZIndex values. This should not prevent you from bringing an item to the front or back of Z order by setting the ZIndex property. Just make sure you are setting it after the item has been added to the diagram, or otherwise the setter does not have any effect.

Stoyan
  
Back to top
 
IP Logged
 
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: SendToBack and BringToFront
Reply #4 - Mar 10th, 2010 at 5:48am
Print Post  
Hi Stoyo

I made one sample. Please find the sample on following url-
https://cid-2b9bf77533900b84.skydrive.live.com/self.aspx/.Public/Copy%20of%20Anc...

In this sample, on start up few nodes are created. You need to change their position slightly to make the look proper.

On the right side, there are 3 button -
1. Create new node in diagram control.
2. Create new node in first container.
3. Change zindex of selected node to 0 to move the item back.

Pressing button 1 & 2 new nodes gets created and you need to re-position them properly.

Now either selecting the newly created node or the nodes which are displayed on startup (which are in container) and pressing the 3rd button changes the Z-Index of the node and the node is moved back.

With node which is on main diagram this works as expected. But with nodes which are in container node, the expected thing is that Z-Index should get applied within container.

Can you help me in achiving this.
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SendToBack and BringToFront
Reply #5 - Mar 11th, 2010 at 8:59am
Print Post  
Hi Rajesh,

Try this:

node.ZIndex = node.Container != null ?
     node.Container.ZIndex + 1 : 0;

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


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: SendToBack and BringToFront
Reply #6 - Mar 11th, 2010 at 10:00am
Print Post  
Hi Stoyo

Thanks. With container it is works. Now new issue with this is that ...

If i send one node to "Back" , result in another node above that node but this new node which is in front can not be send to back ...

As you said, all other nodes Z-index gets changed I guess that is not working correctly.

-Rajesh
  
Back to top
WWW  
IP Logged
 
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: SendToBack and BringToFront
Reply #7 - Mar 17th, 2010 at 5:39am
Print Post  
Hi Stoyo

Any updates on the above issue ?

-Rajesh
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SendToBack and BringToFront
Reply #8 - Mar 17th, 2010 at 7:54am
Print Post  
Hi,

It works fine with the latest version I have. Could you try it with this build we uploaded for you last week -
https://mindfusion.eu/_beta/diaglite14_shapegeom.zip

If you still have this problem, please email a sample project showing it to support@mindfusion.eu.

Stoyan
  
Back to top
 
IP Logged
 
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: SendToBack and BringToFront
Reply #9 - Mar 17th, 2010 at 9:01am
Print Post  
Hi Stoyo

Thanks, It seems sending back works as expected.

Here i have two questions -

1.  I have following two version of the dll -
MindFusion.Graphs.Silverlight.dll  -- 1.1.0.32626
MindFusion.Diagramming.Silverlight.dll  -- 1.3.0.32627

The one I received with previous link contains following version -
MindFusion.Graphs.Silverlight.dll - 1.1.0.19333
MindFusion.Diagramming.Silverlight.dll --1.3.0.19335

How the previous minor version is higher than the one I received thro' the zip file linked above.

2.  What should be the code to bring the node to front  [ It should be bring in the top within the container .... ]

The sample project I mailed you on support@mindfusion.eu

-Thanks
Rajesh


-Rajesh
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SendToBack and BringToFront
Reply #10 - Mar 17th, 2010 at 11:12am
Print Post  
Hi Rajesh,

Probably it was built on a different system and got a different number from the compiler there.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SendToBack and BringToFront
Reply #11 - Mar 17th, 2010 at 11:47am
Print Post  
Try this method:

Code
Select All
void BringToFrontContainer(DiagramNode node)
{
	var container = node.Container;
	if (container != null)
	{
		int maxZ = (from n in container.Children select n.ZIndex).Max();
		node.ZIndex = maxZ;
	}
} 



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


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: SendToBack and BringToFront
Reply #12 - Mar 17th, 2010 at 11:50am
Print Post  
Hi Stoyo

What is solution for my 2nd question -

In the sample, I mailed to you after re-arranging the nodes properly, I see that "Node2" and "Container2" are child of "Container1".

Node2 has index = 3 and Container1's index is 1. Trying to bring the "Container1" in front using "BringToFront" implementation in the sample, container2 comes front and "Node2" is send behind but this results in "Node1" which is child of "Container2" get behind the container2.

-Rajesh
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SendToBack and BringToFront
Reply #13 - Mar 17th, 2010 at 12:03pm
Print Post  
Have you seen the post above?
  
Back to top
 
IP Logged
 
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: SendToBack and BringToFront
Reply #14 - Mar 17th, 2010 at 12:34pm
Print Post  
Hi Stoyo

I have similar code

DiagramNode node = this.diagram.Selection.Items[0] as DiagramNode;
if (node.Container != null)
{
int maxIndex = 0;
foreach (DiagramNode child in node.Container.Children)
{
maxIndex = Math.Max(maxIndex, child.ZIndex);
}
node.ZIndex = maxIndex;
}
else
{
node.ZIndex = this.diagram.Nodes.Count - 1;
}

Even with your code, I have same problem.
The container which is bring front, its childs are set to behind that container.

-Rajesh
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint