Hi Stoyo
I have a container node and child nodes added in it.
By keepting constranins I cannot move child nodes outside the container node.
But at the same time, i need to prevent sizing of container node such that its child item should not be visible outside.
For that I am trying to do something in following event but not giving expected results ...
void diagram_NodeModifying(object sender, NodeValidationEventArgs e)
{
if (e.Node is ContainerNode)
{
ContainerNode con = e.Node as ContainerNode;
Rect r = new Rect(0, 0, 0, 0);
bool first = true;
foreach (DiagramNode item in con.Children)
{
if (first)
r = item.Bounds;
else
r.Union(item.Bounds);
first = false;
}
Rect outerRect = e.Node.Bounds;
if (!((r.Left > outerRect.Left) && (r.Top > outerRect.Top) && (r.Width < outerRect.Width) && (r.Height < outerRect.Height)))
e.Cancel = true; //();// = true;
System.Console.Write("TesT");
}
}
With above code, the node gets resized to its previous state when mouse button was down ... I need to stop it resizing once above condition matches even mouse movement is there ...
I guess it needs to be done in behaviour.
Can you help me in it with some code snipet.
-Rajesh