Hi to all,
I would avoid ovelap between RadDiagramShapes (all rectangle items).
When I set IsSnapToGridEnabled="False" IsSnapToItemsEnabled="true" and move RadDiagramShapes, SnappingEngine uses snap on myshape aligned to other ractangle.
If I try to user MyMovedShaped.Bounds.Rect.IntersectWith(OtherRectangleShape) returns me ever True.
I'm using this code:
01.
private
void
topRadDiagram_Drag(
object
sender, DragRoutedEventArgs e)
02.
{
03.
var diagram = (RadDiagram)sender;
04.
05.
foreach
(var item
in
e.Items)
06.
{
07.
var currentItem = (RadDiagramShape)item;
08.
09.
var shapeItem = (GruppoPianoDiCarico)currentItem.Tag;
10.
11.
foreach
(RadDiagramShape otherItems
in
diagram.Items)
12.
{
13.
if
(otherItems.Tag.GetType() ==
typeof
(GruppoPianoDiCarico))
14.
{
15.
var shapeOther = (GruppoPianoDiCarico)otherItems.Tag;
16.
17.
if
(shapeItem != shapeOther)
18.
{
19.
if
(currentItem.Bounds.IntersectsWith(otherItems.Bounds))
20.
{
21.
//Da ripristinare le coordinate originarie
22.
currentItem.Position =
new
Point(currentItem.Position.X - (e.MousePosition.X - e.StartMousePosition.X),
23.
currentItem.Position.Y - (e.MousePosition.Y - e.StartMousePosition.Y));
24.
}
25.
}
26.
}
27.
}
28.
}
29.
}