I’d like to customize the selection border.
It’s ok for color or strokeline, but I would like give more space between border of selectionhandle and border of spotpanel.
Well, I read in your documentation that :
Thus I assume that this is why the selection has the same width as my node.
SelectionHandle is meant to have the same size and shape as its AdornedElement, more or less. That way it can be used for arbitrarily shaped Shapes such as Links as well as for arbitrary NodeShapes.
Instead, you need to use a different kind of object. Within an Adornment you can use a SpotPanel to cover the bounds of the AdornedPart.
<DataTemplate x:Key="SelectionTemplate">
<Border BorderBrush="Blue" BorderThickness="3" Padding="5"
go:Node.LocationElementName="Panel">
<go:SpotPanel x:Name="Panel" />
</Border>
</DataTemplate>
Use this template by declaring:
Hmmm. Although this works fine for getting selection adornments in the way you want, it seems there’s an undesirable result when the user drags a node – the positioning of the enlarged Adornment isn’t right. We’ll need to investigate that.
Thanks for your sample, it works fine (despite the drag behavior).
[QUOTE=walter]
Hmmm. Although this works fine for getting selection adornments in the way you want, it seems there’s an undesirable result when the user drags a node – the positioning of the enlarged Adornment isn’t right. We’ll need to investigate that.
[/quote]
I think I’ve found another trouble : with this selection template, if you add resize functionnality on the node, you obtain the following figure :
I see the toolhandle are not on the selected border because of the padding. But it is not the worst thing…
By coincidence we happen to already be investigating this.
The resize handles need to be exactly where they are relative to the element being resized, so that it can get accurate sizes. If the resize handles were “far” away, the standard implementation of DraggingTool.ComputeResize would return the wrong value, because it’s assuming the “resize point” is at the center of the resize handle. I suppose you could override this to get what you want, but that would be some work.
Also, the dragging update problem mentioned earlier has been fixed in the most recent beta builds.