Node location got changed while modifying a node

Hi

Look at the image above...
I have 3 categories (Datatemplates) namely...
a.MultiItemCategory
b.SingleItemCategory
c.OtherwiseCategory
In the Section:2 am trying to replace the node of Category MultiItemCategory to SingleItemCategory.
using the following code
if ((this.SelectedNode.Category == RuleNodeConstantDataTemplate.MultiItemCategory)

{
Node leftsideNode = this.GetOtherEnd(this.SelectedNode, "2");
Node rightsideNode = this.GetOtherEnd(this.SelectedNode, "3");
this.rcDiagram.StartTransaction(RuleConstant.Transaction);
ND ruleND = CreateNode(SingleItemCatgory)
List TempCollection;
TempCollection = new List(this.AlreadySelectedItems);
TempCollection.ForEach(i => i.IsSelected = false);
ruleND.Items = new ObservableCollection(TempCollection);
ruleND.Location = leftsideNode.Location;
this.SetITIDForItemNode(ruleND, leftsideNode);
ruleND.IID = Convert.ToString(selectedItem.ItemID);
this.rcDiagram.Model.RemoveLink(leftsideNode.Data, "3", this.SelectedND, "2");
this.rcDiagram.Model.RemoveLink(this.SelectedND, "3", rightsideNode.Data, "2");
this.rcDiagram.Model.AddNode(ruleND);
this.DeleteNode(this.SelectedNode);
this.rcDiagram.PartManager.RemoveNodeForData(this.SelectedND, this.rcDiagram.Model);
this.rcDiagram.Model.AddLink(leftsideNode.Data, "3", ruleND, "2");
this.rcDiagram.Model.AddLink(ruleND, "3", rightsideNode.Data, "2");
this.AssigOperands(leftsideNode);
this.rcDiagram.PartManager.RebuildLinkElements();
this.rcDiagram.Model.CommitTransaction(RuleConstant.Transaction);
}
/// here int the code the selected node will be the --HDR,Right RearSide Compartment #2
(the node in which you can see the popup list box with button named Create Group)
The problem which am facing here is ..The node got replace (ie. the MultiItemCategory to SingleItemCategory) but the issue here is location got changes.. ie..the newly created SingleItemCategory node goes to the button....(which is bug in my case)..the node should get replaced to the same location....
how to do that.....
how to replace the node to the same location
For your reference:
<go:Diagram x:Name="rcDiagram"
Width="Auto"
Height="Auto"
Margin="10,25,0,10"
HorizontalAlignment="Left"
VerticalAlignment="Top"
AllowClipboard="True"
AllowCopy="True"
AllowDelete="False"
AllowMove="False"
AllowReshape="False"
AllowResize="False"
AllowUndo="False"
Background="White"
BorderBrush="{x:Null}"
LinkTemplate="{StaticResource LinkTemplate}"
MaximumSelectionCount="1"
NodeTemplateDictionary="{StaticResource NodeTemplateDictionary}"
Padding="75">

<golayout:TreeLayout NodeSpacing="30"
ConditionFlags="Standard NodeSizeChanged" />

I’m not sure this answers your question about node location, but first I think you should do things the natural way rather than trying to manipulate the Diagram the way that you are.

To replace a Node of one category with another one of a different category, just change the node data’s Category property. Here’s the basic idea:

...StartTransaction(...); var data = this.SelectedNode.Data as ND; if (data !== null) data.Category = "SingleItem"; ...CommitTransaction(...);
Pardon me if I’ve gotten the details wrong with the data types and values, since I’m not familiar with your code.