Add padding for textBlock of a Link


I’m using LinkLabelOnPathDraggingTool and I have label on link, which looks like that

Is there any way to add paddings to textBlock?

I tried this one Padding of textBlock - #4 by walter - doesn’t work


But what do you want instead?

Area with a background around text

Put the TextBlock inside a Panel. Depending on what kind of background you want to show will determine the kind of Panel you use, including whether or not there are additional objects.

Yeah I tried it, like I wrote in a first message with a link to another topic with this solution.
That breaks LinkLabelOnPathDraggingTool - doesn’t work correctly anymore

??? I just tried this, and it worked well:

myDiagram.linkTemplate =
    { routing: go.Link.Orthogonal, corner: 10 },
    $(go.Shape, { toArrow: "OpenTriangle" }),
    $(go.Panel, "Spot",
      // mark this Panel as being a draggable label, and set default segment props
      { _isLinkLabel: true, segmentIndex: NaN, segmentFraction: .5 },
      { background: "magenta", padding: 10 },
      $(go.TextBlock, "a Label", { background: "lime" })

You can comment out the setting of Link.routing, and it still works well.
Or you could set Link.curve to go.Link.Bezier, and it still works well.

I though I can set _isLinkLabel, segmentIndex, segmentFraction properties only on TextBlock.
It works indeed.
Thanks a lot!