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

RadDiagramContainerShape without typical behaviours

2 Answers 56 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Dario Concilio
Top achievements
Rank 2
Dario Concilio asked on 11 May 2017, 01:03 PM

Hi to all,

I need a RadDiagramContainerShape that has not use auto-sizing capabilities, I would afterthat I add several RectangleShapes into RadDiagramContainerShape, I can't move any RectangleShape outside to RadDiagramContainerShape .

How can I do this? .... Can I do this?

2 Answers, 1 is accepted

Sort by
0
Shawn
Top achievements
Rank 1
answered on 11 May 2017, 08:41 PM

Hi Dario,

You can manually control your RadContainerShapes by overriding the CalculateShapeBounds function of your container. This will allow you to set the size of the container and prevent it from being changed based on the children added.

If you are using a layout with your diagram, you will also want to change the LayoutContainerChildren property to prevent the layout algorithm from changing the position of the container children.

Shawn

0
Petar Mladenov
Telerik team
answered on 15 May 2017, 10:15 AM
Hello Dario ,

In addition to Shawn's answer I will propose a solution to prevent dragging shapes from their parent container. You can use the PreviewDrag event of RadDiagram:
private void diagram_PreviewDrag(object sender, DragRoutedEventArgs e)
       {
           foreach (RadDiagramShapeBase shape in e.Items.OfType<RadDiagramShapeBase>())
           {
               if (shape.ParentContainer != null)
               {
                   e.Handled = true;
                   return;
               }
           }
       }


Regards,
Petar Mladenov
Telerik by Progress
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
Dario Concilio
Top achievements
Rank 2
Answers by
Shawn
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or