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

Exception when set UseGlidingConnector = false

2 Answers 72 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 08 Sep 2014, 09:10 AM
Hello,

when you try to reset the UseGlidingConnector property with a connection attached, an exception is thrown.
How can I (programmatically) find the corresponding connection, detach it from the gliding connector and attach it to a normal connector?
And for Undo-Functionality: how can I re-attach it to the gliding connector when performing an undo?

Alex

2 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 10 Sep 2014, 02:02 PM
Hi,

You can use the OutgoungLinks and the IncomingLinks collections of the RadDiagramShape control to traverse all the connections going in out and in of a shape. In order to reset the UseGlidingConnector property you will first need to detach all connections, force the shape to use default connectors (RadDiagramShape.UseDefaultConnectors = true) and reattach the connections.

As for the undo action, it is not supported out of the box. This means that you will need to manually implement the command that will be executed on undo. In order to do so, you can take advantage of the UndoableDelegateCommand. You can use the following snippet to understand how you can use it.

UndoableDelegateCommand myCommand = new UndoableDelegateCommand("Name Of My UndoRedo Command",
                                    c =>
                                    {
                                        //Do Actions
                                    },
                                    c =>
                                    {
                                        //Undo Actions
                                    });
this.diagram.UndoRedoService.AddCommand(myCommand);
I hope that this will be helpful.

Regards,
Pavel R. Pavlov
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Alexander
Top achievements
Rank 1
answered on 11 Sep 2014, 11:12 AM
Thanks for your answer. It was not as simple as expected as I also wanted to remove the default connectors. In this case, you have to perform all actions in a certain ordering, which cannot simply be reversed on undo...
But finally, I can now toggle UseDefaultConnectors and undo it.

Alex
Tags
Diagram
Asked by
Alexander
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Alexander
Top achievements
Rank 1
Share this question
or