[Connect MDL/C++] Dependency between textnote and leader

Hi

I want to place a textnote with leader and establish a dependency between them in a way that when the user moves the text element then the leader will be changed accordingly. So far I got this:

TextBlockPtr textBlock = TextBlock::Create(*DgnTextStyle::GetActive(), *ISessionMgr::GetActiveDgnModelP());
		textBlock->SetUserOrigin(DPoint3d::From(1000, 1000));
		textBlock->AppendText(L"Test");

		EditElementHandle eehText;
		EditElementHandle eehLeaderElm;
		bvector<DPoint3d> leaderPts;
		leaderPts.push_back(DPoint3d::From(0.0, 0.0));
		leaderPts.push_back(DPoint3d::From(2000.0, 2000.0));
		NoteCellHeaderHandler::CreateNote(eehText, eehLeaderElm, *textBlock, *DimensionStyle::GetActive(), ISessionMgr::GetActiveDgnModelRefP()->Is3d(), *ISessionMgr::GetActiveDgnModelRefP(), leaderPts);

		eehText.AddToModel();
		eehLeaderElm.AddToModel();

		DependencyLinkage depLinkageLeader;
		if (SUCCESS == DependencyManagerLinkage::InitLinkage(depLinkageLeader, DEPENDENCYAPPID_MicroStation, DEPENDENCY_DATA_TYPE_ASSOC_POINT_I, DEPENDENCY_ON_COPY_DeepCopyRootsAlways))
		{
			depLinkageLeader.nRoots = 1;
			depLinkageLeader.appValue = DEPENDENCYAPPVALUE_AssocPoint;

			AssocPoint assocPt;
			AssociativePoint::InitOrigin(assocPt, AssociativePoint::CreateOptions::CREATE_ASSOC_Normal);
			AssociativePoint::SetRoot(assocPt, eehText.GetElementId(), 0, 0);
			depLinkageLeader.root.assoc[0] = assocPt;

			// Rewrite leaderelm
			ElementRefP oldFirstRef = eehLeaderElm.GetElementRef();
			DependencyManagerLinkage::AppendLinkage(eehLeaderElm, depLinkageLeader, 0);
			eehLeaderElm.ReplaceInModel(oldFirstRef);
		}

		DependencyLinkage depLinkageText;
		if (SUCCESS == DependencyManagerLinkage::InitLinkage(depLinkageText, DEPENDENCYAPPID_Note, DEPENDENCY_DATA_TYPE_ELEM_ID, DEPENDENCY_ON_COPY_DeepCopyRootsAlways))
		{
			depLinkageText.nRoots = 1;
			depLinkageText.appValue = DEPENDENCYAPPVALUE_Label;
			// Add the leader element as root
			depLinkageText.root.elemid[0] = eehLeaderElm.GetElementId();

			// Rewrite
			ElementRefP oldFirstRef = eehText.GetElementRef();
			DependencyManagerLinkage::AppendLinkage(eehText, depLinkageText, 0);
			eehText.ReplaceInModel(oldFirstRef);
		}

At first glance it works fine but when I move the text element the leader element is modified in a way so it starts at the origin of the text elements original position and points to the new position.

What am I doing wrong ?

TIA.

Regards, Evan