Diagram Connection Source/Target Problem On Load

0 Answers 90 Views
Diagram
kim
Top achievements
Rank 1
Iron
kim asked on 09 Nov 2021, 07:41 AM

I use diagram each Tab Item.

And I tried save & load diagram.

it worked. but, connection's Source/Target is null when I change the tab.

then I checked DeserializeLink in GraphSource.

'base.DeserializeLink(connection, info)' is not return Source/Target.

Help me,,,

 

in GraphSource.

public override void SerializeLink(Link link, SerializationInfo info)
        {
            this.ClearCache();
            base.SerializeLink(link, info);
        }
        public override Link DeserializeLink(IConnection connection, SerializationInfo info)
        {
            return base.DeserializeLink(connection, info);
        }
Martin Ivanov
Telerik team
commented on 11 Nov 2021, 01:04 PM

Can you send over a runnable sample showing the complete setup? This way I can run it and see if I can come up with a solution.
kim
Top achievements
Rank 1
Iron
commented on 29 Nov 2021, 07:57 AM

I made some sample.

In sample,  seems like linked. but, Source/Target's Content is null in GraphSource Link.

Martin Ivanov
Telerik team
commented on 30 Nov 2021, 12:51 PM

Thank you for the project. I've tested it with the latest version of Telerik UI for WPF, but I wasn't able to reproduce the issue. On my side, the Source and Target properties of the connection are not null in the DeserializeLink() method. Here are the steps that I follow:

  1. In the first tab, I create a copy of the shape using Ctrl+C and Ctrl+V.
  2. Then, I connect the two shapes using the mouse, which creates a connection object.
  3. I click the Save button and save an .xml file with the current diagram.
  4. I open the second tab, and Load the previously saved .xml file. At this point everything works as expected.
  5. I delete the diagrams from both tabs and use the Load button to load the saved .xml again. Everything works as expected in both tabs.

Please let me know if I am missing anything.

I also attached the test project that I've used.

kim
Top achievements
Rank 1
Iron
commented on 30 Nov 2021, 11:46 PM

It looks like it's connected, but Source/Target is null in Graphsource links  property using tab_SelectionChanged Event on behind-code.

I Checked another Method in GraphSource. When I check the param of the method, Source/Target is null.

This is Method that I added in GraphSource.

public override void AddLink(Link link)
        {
            base.AddLink(link);
        }

Martin Ivanov
Telerik team
commented on 03 Dec 2021, 09:03 AM

I am not sure that I understand your setup. Can you edit my project to recreate this and list the steps that should be executed?
kim
Top achievements
Rank 1
Iron
commented on 05 Dec 2021, 11:48 PM


  1. In the first tab, I create a copy of the shape using Ctrl+C and Ctrl+V.
  2. Then, I connect the two shapes using the mouse, which creates a connection object.
  3. I click the Save button and save an .xml file with the current diagram.
  4. I open the second tab, and Load the previously saved .xml file. At this point everything works as expected.

this steps are correct.

Next, Set break point on tab_SelectionChanged in behind-code.

and graphsource's link info is somethig worng in diagram that loaded file.

 


Martin Ivanov
Telerik team
commented on 06 Dec 2021, 02:08 PM

I've tested this, but on my side the link has both is Source and Target. Can you check the images and tell me if I am missing anything?
kim
Top achievements
Rank 1
Iron
commented on 06 Dec 2021, 11:29 PM

sorry, I didn't explain well.

your image is correct Source and Target's Data is null.

if Diagram's datacontext is changed and return, that info cause error.

So, I want keep Source and Target's Info when Loaded.

Martin Ivanov
Telerik team
commented on 09 Dec 2021, 12:11 PM

Can you record a video showing the issue? This will give me a better idea for the concrete situation.
kim
Top achievements
Rank 1
Iron
commented on 10 Dec 2021, 12:40 AM

In your image, link's info is different.

I think link's info is same in diagram1 and diagram2.

 

In my project, I use diagram in tab to usercontrol.

so tab's selecteditem is changed to viewmodel.

if link's info in graphsource is different that diagram's link is different.

Martin Ivanov
Telerik team
commented on 10 Dec 2021, 01:35 PM

I am afraid that without recreating this I cannot tell what exactly happens. If you can modify my project (from one of the previous replies here) to produce the same issue I will take a look.

kim
Top achievements
Rank 1
Iron
commented on 13 Dec 2021, 12:24 AM

I found my mistake when recreating example.

Thanks a lot.

 

No answers yet. Maybe you can help?

Tags
Diagram
Asked by
kim
Top achievements
Rank 1
Iron
Share this question
or