Select A Node With Partial Selection Area


Im trying to enable a behavior in which a node can become selected even though i did'nt surround it entirely , (by using the drag selecting tool and dragging a rectangle that is smaller than the hole node but still selectes a part of the node).
is there an easy way to achieve that functionality with any property of the drag selecting tool \ any way at all ?
thanks for the help

Look at the Remarks for the DragSelectingTool class.

I did that before the post , it did’nt help me.

To be sure, I just added that XAML to a random sample Diagram, and it changed the “rubber-band” drag-selection behavior just as advertised.

So I don’t know what to say. Maybe there’s something different about your app? I suppose you could try adding the same XAML into one of the sample apps, to see if it works for you at all.

I found a solution , im just gonna post it for others to see if they’ll need it one day .

after investigating a bit i found out that the DragSelectingTool class takes consideration
of the rectangle that was created when the mouse up event occure , and then
SelectInRect method is called and selects nodes within the rectangle.
so i inherit the class DragSelectingTool which lucky me is a public virtual method
and i override this method :
public class CustomDragSelectingTool : DragSelectingTool
public override void SelectInRect(Rect r)
in this method , which i copy entirely to the new class
except i just use
SearchInclusion.Intersects of the enum, instead of the built in call which was
SearchInclusion.Inside -> (thats what forces a selection of the hole node , the only thing that will make the node selected)
while intersects enables the selection of a node even if u only drop on the node after creating even a small rectangle .
HashSet<Part> parts = new HashSet<Part>(diagram.Panel.FindPartsIn<Part>(r, SearchFlags.SelectableParts,SearchInclusion.Intersects, SearchLayers.Parts));
ofcourse i use from now on this custom class i created as my DragSelectingTool
Diagram.DragSelectingTool = new CustomDragSelectingTool();
good day

If I understand you correctly, that is exactly the effect one gets when setting the DragSelectingTool.Include property, as the documentation shows can be done in XAML without writing any code.

when u sayd "remarks" i did'nt get the specific location of what u ment, perhaps it could be easier to understand , if u posted the hole thing like:

This is a standard mouse-move tool.

For example, you can change the selection policy in XAML by:

Then I would'nt hhave to do stuff like override DragSelectinTool methods! 
any way your solution is much better than mine for sure... 
thanks , 

I’m sorry – I thought the context of looking at documentation was clear, so that “Remarks” had to refer to the “Remarks” section of the API documentation for that class.

Well, that’s what I get for trying to answer early in the morning before going to work.

A detailed answer (which in this case required copy paste) is always better then 8 words .

no harm done .

I was using a tablet, and it’s hard to type much or to copy-and-paste from the documentation on our web site with a tablet. Keyboard and mouse are much better for writing.