We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to disable Line connectors

Hello,

At some point I have to prevent any manipulations with Line connectors in Diagram control (switching from design to runtime mode for example). I use Allow/IsXXX properties and PreviewXXX events for nodes but I cannot see how to do it for connectors. I used something like:

connector.AllowDrop = false;
connector.IsEnabled = false;
connector.IsLabelEditable = false;

I cannot disable the entire Diagram control as I still need to select nodes and process double-click events. Any info is highly appreciated.

Thank you,

Arthur Amshukov


3 Replies

MA Maria Amal Raj T Syncfusion Team February 11, 2011 12:25 PM UTC

Hi Arthur,

Thanks for your interest on Syncfusion Products.

When the DiagramView's IsPageEditable property is set to false Editing options will be disables, and operations link selecting and dragging the Nodes and LineConnector is not possible. To prevent only line related operations, please set IsHitTestVisible property to false. This will hide the LineConnector to receive any mouse related operations.

Code Snippet:

1. To Disable DiagramControl:

DiagramView diagarmView=new DiagramView();
diagramView.IsPageEditable=false;

2. To Disable LineConnectors without affecting Node:

//set to IsPageEditable to true.
DiagramView diagarmView=new DiagramView();
diagramView.IsPageEditable=true;

//set to LineConnector's IsHitTestVisible to false.
LineConnector connector = new LineConnector();
connector.IsHitTestVisible = false;

From the second method Node Select and double click event also fire without any changes in the LineConnectors.

Please let me know if you have any further queries.

Regards,
Maria Amal Raj T.
(Diagram WPF and Silverlight Team)



MF Mary Fontana March 22, 2011 06:30 PM UTC

A related question.

How do you disable moving of line connectors, but still allow the connector show a tool tip?

If I do line.IsHitTestVisible = false; The tooltip is also disabled.





MA Maria Amal Raj T Syncfusion Team March 23, 2011 09:15 AM UTC

Hi Mary,

By setting IsHitTestVisibility to false will hide the line from the mouse related operations. So, tool tip will not appear. Currently, disabling LineConnector from dragging is not supported. However, as a workaround, the Decorator shares and the Vertex can be hidden, which in turn disables Line from getting dragged as shown in the following code snippet.

Code Snippet :




LineConnector line = new LineConnector();
//Hide the Vertex
line.IsVertexVisible = false;
//Hide the Decorator shares
line.DecoratorAdornerStyle = this.Resources["HidenThumb"] as Style;
//Disable label editing
line.IsLabelEditable = false;
line.ToolTip = "NewToolTip";

Regards,
Maria Amal Raj T,
Diagram WPF & Silverlight Team,
[Syncfusion].




Loader.
Live Chat Icon For mobile
Up arrow icon