You really ought to combine the transactions by surrounding the whole loop with the calls to StartTransaction and CommitTransaction, rather than having N separate transactions.
How did you data-bind to your MyData.Spot property?
Probably you don’t need Mode=TwoWay, but that depends on whether you expect to change it in code and have it automatically update the bound MyData object.
Your links are actually connected to the node with a port parameter of “T”, yes?
I want to create a spot and then bind his position with the position I
get with GetLinkPointFromPoint function in order to put the spot on my
shape borders.
I first start creating a spot on MiddleTop and I would like to change his position with this code :
foreach (Node node in myDiagram.SelectedParts)
{
MyData data = node.Data as MyData;
Point pointSpot = route.CustomGetLinkPointFromPoint(node,
node.Port,
new Point(localisation_x, localisation_y),
new Point(localisation_x + 100, localisation_y),
true);
But I am not sure this is the way to set X and Y…
Should I do it like this?
I saw this in your API Reference manuals, if I change 0.7, Y change and if I change -20, my spot change on the X axe. But I don't understand what 1 and 0 are... :$
I finally succeded, I have always one issu, my diagram doesn’t actualize itself… I have to click on my node to see the new spot… I don’t know how to solve this…
I was going to suggest reading about the Spot structure, which provides a way of computing a point in a rectangular area based on relative/fractional positioning plus absolute offsets.
I still don’t understand what you are trying to do, so it’s hard for me to provide useful suggestions. I don’t know if you are trying to modify the node by adding elements acting as ports at certain positions specified by Spot values, or if you just want to modify a link by setting its Route’s FromSpot or ToSpot so that it (and it alone) connects to a port at a particular position.
As you can see, after using my fonction, my spot are now on my figure borders :)
I create these in my xaml, then, in my MainPage.xaml.cs I create a function that set the position of my spots :
The only issu I still have is that I have to click on my node to see the new position of my spots… The new position is actualized after clicking on my node… It’s just a displaying issu but I can’t find how to solve it…
I haven’t had time to look into this, so I can’t explain why it’s not working for you. Maybe you can get around the problem by calling Part.Remeasure() on each Node that you have modified.