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.
Unfortunately, activation email could not send to your email. Please try again.

How to disable Line connectors

Thread ID:

Created:

Updated:

Platform:

Replies:

98155 Feb 9,2011 10:08 PM Mar 23,2011 05:15 AM WPF 3
loading
Tags: Diagram
Arthur Amshukov
Asked On February 9, 2011 10:08 PM

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


Maria Amal Raj T [Syncfusion]
Replied On February 11, 2011 07:25 AM

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)


Mary Fontana
Replied On March 22, 2011 02:30 PM

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.




Maria Amal Raj T [Syncfusion]
Replied On March 23, 2011 05:15 AM

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].




CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;