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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Model Update

Thread ID:

Created:

Updated:

Platform:

Replies:

94204 Apr 29,2010 09:23 AM UTC May 20,2010 06:39 AM UTC WinForms 6
loading
Tags: Diagram
Ben Wang
Asked On April 29, 2010 09:23 AM UTC

Hello,
i'm using Syncfusion Diagram 7.4.0.20.
i make two models, and want to switch them.
but there's some problem.

i make the second model, and set that ..
this.diagram1.Model = model2;

and i add an icon, and move it.
the diagram doesn't update view!!

please help me
thank you ~

ben.



ModelUpdate_3f74e94e.rar

Melba Winshia [Syncfusion]
Replied On May 4, 2010 06:23 AM UTC

Hi Ben,

Thank you for contacting Syncfusion Support.

To update model please use the BeginUpdate() and EndUpdate methods.

[C#]

this.diagram1.Model.BeginUpdate();

//Some code here

this.diagram1.Model.EndUpdate();


Please try this and let me know if this helps.

Thanks,
Melba

Ben Wang
Replied On May 5, 2010 02:57 AM UTC

hi:
thanks for your help.

but it doesn't work.
i call the "this.diagram1.Model.BeginUpdate()"
and "this.diagram1.Model.EndUpdate()"
in Model_PinPointChanged Event.

is sumthing wrong? or something need to do for model's setting?


Ben Wang
Replied On May 6, 2010 01:50 AM UTC

hi Melba:

I think i know what's wrong.

i create one node,
and append it to two different models.

can't the node be appedned in different model?

Thanks.

Melba Winshia [Syncfusion]
Replied On May 11, 2010 01:02 PM UTC

Hi Ben,

You can create a node and append it to two different models. Please refer to the following sample which illustrates this:

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=Diagram_WF_LabelTextNode889079461.zip

Please have a look at the above sample and if still the issue exists, could you please try reproducing in the above sample and send us the modified sample so that we could sort out the cause of the issue and provide you a solution?

Thanks,
Melba

Ben Wang
Replied On May 12, 2010 03:07 AM UTC

hi Melba

it still can't work.
the modified sample code is attached.

please click the button and move the icon.

thanks
Ben



Modify_ea67851b.rar

Melba Winshia [Syncfusion]
Replied On May 20, 2010 06:39 AM UTC

Hi Ben,

We regret for the delayed response.

I am able to see this issue. But this issue can be resolved by using AttachModel method. When you attach a new model, only the newModel is set to view.Model. So it renders only the nodes. The newModel is not set to Controller.Model. So you can't interact with the nodes. Because all the interactive functionalities (Select, move, rotate, resize) are integrated into the DiagramController. If you want to interact with the nodes, then you have to assign the attached model to Controller.Model. But Controller.Model is read-only. So you need to derive DiagramController and hide the Model property and then you can write the set accessor. Please refer to the following code snippet:

private void button1_Click(object sender, EventArgs e)
{
this.newdiagram.Model.BeginUpdate();
if (this.newdiagram.Controller.Model == model1)
{
this.newdiagram.AttachModel(model2);
((CustomDiagramController)this.newdiagram.Controller).Model = this.model2;
}
if (this.newdiagram.Controller.Model == model2)
{
this.newdiagram.AttachModel(model2);
((CustomDiagramController)this.newdiagram.Controller).Model = this.model1;
}

this.newdiagram.Model.EndUpdate();

this.newdiagram.Refresh();
}


Please refer to the sample in the following link which illustrates this:

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=F94204_ModelUpdate510468238.zip

Please let me know if this helps.

Thanks,
Melba

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;