Selectionhandle question

Hello,

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.

After that I try to add margin in my style :

<DataTemplate x:Key="SelectedTemplate">
        <go:SelectionHandle StrokeThickness="1.5"
                             Stroke="Gray"
                             StrokeDashArray="2,2"
                             Margin="-2">
        </go:SelectionHandle>
    </DataTemplate>

But obviously it is not the solution.

Well, I made my own class to indicate the SelectionHandle new size :

public class SelectedNode : SelectionHandle
    {
        protected override Size MeasureOverride(Size constraint)
        {
            Size sz = base.MeasureOverride(constraint);
            sz = new Size(sz.Width + 100, sz.Height + 100);

            return sz;
        }
    }

But I’m wrong someway because it doesn’t change anyway…

Have you a recommendation ?

Thanks
Aurore

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:

go:Part.SelectionAdorned="True" go:Part.SelectionAdornmentTemplate="{StaticResource SelectionTemplate}"

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.

Hello,

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…

When I resize I obtain the following issue :

The selection border is not actualized.

Have you an idea of why ?

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.

OK, the problem with not updating the SpotPanel when resizing will be fixed in the 1.1 release.

Great !

thank you.

Aurore