We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Updating a node inside a group doesn't update Group's handle size

Good morning,

I'm having  problem in my implementation. The context goes like this:

I have crated an extension to the group node for my implementation, that contains a BitMapNode, and a Rectangle node (that will have variable size and text as a label) and other components. When i update the Rectangle's text the size also varies but when I select it the node's handles do not show an update to the bounds. I have tried a lot of the update methods but there is no success. I am having an Overflow exception in another part and there is the possibility that this might be the cause.

here is the code where i change the text's content (this reffers to my custom Group class).

public void ChangeLabel(string txt)
       {
           if (txt != null && txt != string.Empty)
           {
               this.model.BeginUpdate();
               //if (this.model.Nodes.Contains(this)) this.model.RemoveChild(this);
               
               var sizeSpace = ((txt.ToArray<char>()).Count()) * 8;
               if (this.Nodes.Contains(this.StepnameLabel)) this.RemoveChild(this.StepnameLabel);
               this.StepnameLabel = new Syncfusion.Windows.Forms.Diagram.Rectangle(BmpNode.PinPoint.X - sizeSpace / 2, BmpNode.PinPoint.Y + 30, sizeSpace, 15, MeasureUnits.Pixel);
 
               var color = Color.Transparent;
 
               var label = new Syncfusion.Windows.Forms.Diagram.Label(StepnameLabel, txt);
 
               label.FontStyle.Family = "Segoe UI";
               this.StepnameLabel.Labels.Add(label);
               StepnameLabel.FillStyle.Color = color;
               StepnameLabel.LineStyle.LineColor = color;
               StepnameLabel.Visible = true;
               StepnameLabel.EditStyle.AllowSelect = false;
               this.AppendChild(this.StepnameLabel);
 
               
                   this.Name = "something";
              
 
               
 
               //this.model.AppendChild(this);
               this.model.EndUpdate();
               
           }
}

I upload images to display the problem.

Thank you for your quick response.






Attachment: graphicbug_d810adec.zip

1 Reply

DS Devaraj Sekar Syncfusion Team April 25, 2016 12:04 PM UTC

Hi Sergio, 
Thanks for using Syncfusion Product. 
Please use group’s “UpdateCompositeBounds()” method to achieve your requirement. 
 
Code Snippet: 
public void ChangeLabel(string txt) 
{ 
…. 
this.AppendChild(this.StepnameLabel); 
// To Update Group’s Bounds. 
this.UpdateCompositeBounds(); 
}  

Regards, 
Devaraj. S. 


Loader.
Live Chat Icon For mobile
Up arrow icon