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.

Trying to load saved diagram xaml file into diagram control not working

Thread ID:

Created:

Updated:

Platform:

Replies:

117109 Aug 13,2014 04:07 PM Sep 23,2014 12:02 PM Silverlight 24
loading
Tags: Diagram
Chase Novack
Asked On August 13, 2014 04:07 PM

Hello,

I'm having an issue with the DiagramControl's Load() method. I'm trying to load in a saved xaml file created by the Diagram control's Save() call. The file is located in a folder within  my Silverlight project. I've tried to load the file the following ways, both of which have failed (the Load method without parameters works fine however): 

First way: 

System.Windows.Resources.StreamResourceInfo streaminfo = Application.GetResourceStream(new Uri("/PlayerProject;component/test2.xaml", UriKind.Relative));
Stream str = streaminfo.Stream;
str.Position = 0;
MessageBox.Show("File found!");
diagramControl.Load(str);

This fails with an "Object reference not set to an instance of an object" error. 


Second way: 

diagramControl.Load("/PlayerProject;component/test2.xaml");

This fails with an "illegal xml character [Line: 1 Position: 2]" error. 

Any insight on this would be great. 

Thanks,
Chase

Mohana Priya Raja [Syncfusion]
Replied On August 18, 2014 08:41 AM

Hi Chase Novack,

 We are analyzing your requirement "load the saved xaml file directly". We will update with you on Wednesday August 20th ,2014.

 

Please let us know if you have any concerns.

Regards,

MohanaPriya R

 


Chase Novack
Replied On August 21, 2014 02:17 PM

Mohana,

Any updates regarding this issue yet? 

Thanks,
Chase

Saranya Chandrasekaran [Syncfusion]
Replied On August 25, 2014 08:46 AM

Hi Chase,

Regarding “To Load saved xaml file in Silverlight”, your requirement has been achieved by using GetResourceStream() method to load the saved xaml file from the Project Folder. We have created simple sample to meet your requirement. Please refer to the sample from the Attached file.

 

Note: To load already saved xaml file from Project folder, please change BuildAction property to Resource (using Properties)

Sample Details:

We have used two buttons labelled as “Save” to serialize the current diagram page and “Load” to deserialize the already saved xaml file in the resource.

 

Please let us know if you have any concerns.

Regards,

Saranya C


Attachment: 117109_14d150c4.zip

Chris Goodwin
Replied On August 27, 2014 04:31 PM

Hello, I am working closely with Chase on this issue. We have ran your project and it did run just fine, but when we try to implement it into our project, we still get the same issue. I have created a test project that is very similar to the structure of our current project. These issues are duplicated in this test project. I have attached it to this message. I think that it may have to do with having the web project implemented into our solution, while your test projects did not have one implemented.
Attachment: TestProject_67f16982.zip

Saranya Chandrasekaran [Syncfusion]
Replied On August 28, 2014 07:45 AM

Hi Chase,

We are working on your requirement. We will update you on tomorrow August 29, 2014

Please let us know if you have any concerns.
Regards,
Saranya C

Saranya Chandrasekaran [Syncfusion]
Replied On August 31, 2014 12:21 PM

Hi Chase,

Regarding “Trying to load saved diagram xaml file into diagram control not working” to you reported scenario, we have modified your given sample in mainpage.xaml. Please refer to the attached sample.


Please let us know if you have any concerns.

Regards,

Saranya C


Attachment: TestProject_32d03bd0.zip

Chase Novack
Replied On September 8, 2014 02:29 PM

Saranya,

The test project you linked worked as expected, but we still cannot get our actual project to work. What changes did you make to the project we linked you in order to get the latest one working?

Thanks,
Chase

Saranya Chandrasekaran [Syncfusion]
Replied On September 9, 2014 03:08 AM

Hi Chase,

Sorry for the inconvinence caused.

Regarding “Trying to load saved diagram xaml file into diagram control not working”, we have analyzed your attached sample and modified to meet your requirement.

Problem with your sample:

We have referred your “MainPage.xaml” file, you have missed to add the model and view to the DiagramControl. Please refer to the following code snippet and comments.

<Grid x:Name="LayoutRoot" Background="White">

<!--Here, you are not using model and view in DigarmControl so that you are not able to render the node while save and load-->

<Syncfusion:DiagramControl Name="dc" BorderBrush="Black" BorderThickness="1" Background="White"HorizontalAlignment="Left" Height="300" VerticalAlignment="Top" Width="400"/>

<Button Content="Load" Click="Button_Click" Width="120" Height="30" />

</Grid>

 

We have provided video to notify changes made in the sample. Please refer to the attached video.

Please refer to the following online help documentation link for more information about Diagram.

Link: http://help.syncfusion.com/ug/silverlight/documents/addingthroughxaml.htm

Please let us know if you have any concerns.

Regards,

Saranya C


Attachment: TestProjectsVideo_6e4439df.zip

Chase Novack
Replied On September 9, 2014 10:36 AM

Saranya,

Thanks for getting back to me so quickly. I see the lack of diagram model and view you mentioned in the test project we sent you, but our actual project does have a diagram view and diagram model in the XAML, and yet still doesn't work. We do use RIA services and entity framework for our database communication. Could that maybe be causing this issue in our actual project?

Thanks,
Chase

Saranya Chandrasekaran [Syncfusion]
Replied On September 10, 2014 08:26 AM

Hi Chase,

We are working on your requirement, we will update you with the task status on tomorrow September 11, 2014.

Please let us know if you have any concerns.

Regards,

Saranya C


Chase Novack
Replied On September 10, 2014 01:56 PM

Just an update on our current situation. I've tried to implement the diagram control in a different user control in our project, but referencing the same test xaml file, and now the user control doesn't load at all once the Load() method is run. I know that the StreamResourceInfo object is being created (as it's not null) so the problem must be with the Load() call.

Saranya Chandrasekaran [Syncfusion]
Replied On September 11, 2014 08:59 AM

Hi Chase,

Regarding “RIA services and entity framework for our database communication causing this issue in our actual project?” to you reported query, we suspect that RIA services will not affect your original project while Load() the already save xaml file. It could be better for us if you provide sample/video to meet your requirement.

Please let us know if you have any concerns.
Regards,
Saranya C


Chase Novack
Replied On September 12, 2014 04:23 PM

Saranya,

I've attached a sample project that is erroring out, this is different behavior than what we are seeing currently (the user control is failing to load but is not erroring out) but this is the same behavior we've had in the past with the Load() call that we still have not solved (object reference is not set to an instance of an object error). I know that the stream is being created correctly (I do a null check on it) but the Load() call still errors out.

Thanks,
Chase

Attachment: TestProject_32d03bd0_cbb8f934.zip

Chase Novack
Replied On September 12, 2014 04:24 PM

I feel like it may have something to do with the fact that we are trying to load the diagram on page load instead of a button click like in the previous sample (loading the diagram on page load automatically is a requirement for us).

Saranya Chandrasekaran [Syncfusion]
Replied On September 15, 2014 01:00 PM

 

Hi Chase,

We are working on your requirement. We will update you with the task status on tomorrow September 16th, 2014.

Please let us know if you have any concerns.

Regards,

Saranya C


Saranya Chandrasekaran [Syncfusion]
Replied On September 16, 2014 08:53 AM

Hi Chase,

Regarding “To load diagram on page without using button click”, we have analyzed your requirement from your query. Your requirement to load the diagram automatically on the page without using button click is achieved. We have provided simple sample to meet your requirement. Please refer to the sample from the following link.

 

Please let us know if you have any concerns.

Regards,

Saranya C


Chase Novack
Replied On September 16, 2014 10:16 AM

Saranya, 

I don't see a link to the sample project on my end. 

Chase

Saranya Chandrasekaran [Syncfusion]
Replied On September 16, 2014 11:48 PM

Hi Chase,

Sorry for the inconvenience caused.

Regarding “To load diagram on page without using button click”, we have analyzed your requirement from your query. Your requirement to load the diagram automatically on the page without using button click is achieved. We have provided simple sample to meet your requirement. Please refer to the attached sample.

 

Please let us know if you have any concerns.

Regards,

Saranya C


Saranya Chandrasekaran [Syncfusion]
Replied On September 17, 2014 01:48 AM

Hi Chase,

Sorry about the inconvenience caused. 

Regarding “To load diagram on page without using button click”, we have analyzed your requirement from your query. Your requirement to load the diagram automatically on the page without using button click is achieved. We have provided simple sample to meet your requirement. Please refer to the sample from the following link.

Link: http://www.syncfusion.com/downloads/support/directtrac/general/117109587561415.zip

Please let us know if you have any concerns.

Regards,

Saranya C


Chase Novack
Replied On September 18, 2014 09:39 AM

Saranya,

I've downloaded and run the sample project, and it's not working for me. I'm getting an 'Object reference not set to an instance of an object' error on the DiagramControl.Load(s.Stream) call, just as happens in the test project I linked previously. Do you have any idea why this project would work for you guys and not on my machine? 

Chase

Chase Novack
Replied On September 18, 2014 10:25 AM

Saranya,

We've done some more testing with the sample project. As is, with the Load() call after InitializeComponent() it errors out with a null reference exception. If we put the Load() call inside of the user control's Loaded event call, it doesn't error out but the diagram file doesn't load inside the control (the control is blank). If we put the Load() call inside of a button click event call, it works as expected. Any idea why we're seeing this varying behavior from the Load() function?

Thanks,
Chase

Chase Novack
Replied On September 18, 2014 02:16 PM

We've been able to solve the issue by implementing the Load() call inside the User Control Loaded event along with a DispatchTimer set for a short (10 ms) delay. I'm not sure what's going on internally that needs to complete before the diagram can load, but putting a short delay on the load call makes it work as expected. I've attached a class file that we use to implement the delay (the setTimeout function is the one we call from our page). 

Saranya Chandrasekaran [Syncfusion]
Replied On September 19, 2014 08:13 AM

Hi Chase,

We are working on your requirement, we will update you on Monday September 22nd, 2014.

Please let us know if you have any concerns.

Regards,

Saranya C


Ramya Thirugnanam [Syncfusion]
Replied On September 23, 2014 12:02 PM

Hi Chase,

We deeply regret for the inconvenience caused.

We are unable to reproduce the reported issue with DiagramControl.Load with Diagram Silverlight. The DiagramControl.Load is working fine in our side it would be better for us if you provide the sample /video/Stack trace to replicate the reported issue. This help us to serve you better.

Please let us know if you have any concerns,
Regards,
Ramya


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.

;