This is a migrated thread and some comments may be shown as answers.

Customizing the Connection Manipulation Adorner

1 Answer 173 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Trevor
Top achievements
Rank 1
Trevor asked on 03 Jul 2017, 02:21 AM
I created a custom diagram shape style that has the content presenter above the shape. The shape looks great until I select it or attempt to create connections to it. I want the selection box only around the shape and not the text. The connectors are also not attached to the connection points on the shape. I have included some images of the issues I am seeing. I assume it has something to do with modifying the manipulation adorner to target the shape within the DiagramShape rather than the entire DiagramShape.

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 05 Jul 2017, 09:29 AM
Hello Trevor,

The reported behavior is expected. The shape bounds include everything in the shape's template regardless the position of its geometry. 

I can suggest couple of approaches for achieving your requirement. 
  • The first one is to use two separated shapes - one for the shape's geometry (the rectangle) and another one for the label above. Then you can sync the Position of both the shapes and cancel the selection for the one with the label.
  • The second approach is to manually update the boundaries of the manipulation adorner. You can do that via the AdornerService class. For example:
    private void radDiagram_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        AdornerService adornerService = this.diagram.ServiceLocator.GetService<IAdornerService>() as AdornerService;
        adornerService.UpdateAdornerBounds(new Point(0, 10), 0, -10);
    }
    This will offset the manipulation adorner with 10 pixels on Y and reduce its height with 10px. Here you can use the size of the ContentPresenter that show the label in the shape and 

I hope this helps.

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
Diagram
Asked by
Trevor
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or