Page Index Toggle Pages: [1] 2  Send TopicPrint
Very Hot Topic (More than 25 Replies) WPF diagram from Silverlight diagram (Read 13590 times)
lightsundar99
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 15
Joined: Nov 15th, 2016
WPF diagram from Silverlight diagram
Jan 30th, 2017 at 12:25pm
Print Post  
Hi Mindfusion,

We are now doing migration from
Silverlight mindfusion diagram to WPF diagram.

We want  Silverlight and wpf both need to use same code.

What is the step we have to do .please give me the difference and procedure.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: WPF diagram from Silverlight diagram
Reply #1 - Jan 30th, 2017 at 1:29pm
Print Post  
Hi,

The API should be very much the same, but there are still some difference for which you'd need to use conditional compilation directives if you need to compile from same source code, e.g. for namespace -

Code
Select All
#if WPF
using MindFusion.Diagramming.Wpf;
#else
using MindFusion.Diagramming;
#endif 



Another difference is in Xaml templates if you use them - in Silverlight version DiagramItem derives from the Control class and items are templated using ControlTemplate, while in WPF you'd have to use DataTemplate. E.g. check how templates are organized in Tutorial3 sample project installed for both platforms.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
lightsundar99
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 15
Joined: Nov 15th, 2016
Re: WPF diagram from Silverlight diagram
Reply #2 - Jan 31st, 2017 at 5:14am
Print Post  
Thanks for your reply...

My doubt is .. I have to use common code for both.. WPF and Silverlight.

How to handle template in  common way for both in this case.

Thanks,
Sundar M.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: WPF diagram from Silverlight diagram
Reply #3 - Jan 31st, 2017 at 9:02am
Print Post  
You will need to keep separate Xaml code for at least the ControlTemplate / DataTemplate definitions. You already have separate Xaml files for the WPF window and Silverlight page so you could define default templates there. Then you could refactor the content part of the templates to a separate class and load it in nodes' Xaml using a ContentPresenter.

If it will work for you, we could as well implement the TemplatedNode class from WPF diagram in Silverlight - then you'd be able to define appearance using DataTemplate for both platforms.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
lightsundar99
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 15
Joined: Nov 15th, 2016
Re: WPF diagram from Silverlight diagram
Reply #4 - Jan 31st, 2017 at 10:37am
Print Post  
Thanks for your reply..
Actually I need to keep one file for both WPF and Silverlight.
I understand that Template concept is totally different from WPF and Silverlight. But i have lot of dependncies in XAML and CS file.
Is there any way or please provide some code snippet like
I can dynamically load Template through XamlReader.Load()
or some other way...
Thanks in advance..
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: WPF diagram from Silverlight diagram
Reply #5 - Feb 1st, 2017 at 9:07am
Print Post  
We have an oldish project that builds WPF control assembly from the Silverlight code, I think that will be best for your purpose letting you reuse all code and templates from your Silverlight app. Let me check if I can compile it with our latest Silverlight diagram code.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: WPF diagram from Silverlight diagram
Reply #6 - Feb 1st, 2017 at 11:15am
Print Post  
This contains WPF assemblies built from Silverlight code, please check if it will work for you -
https://mindfusion.eu/_temp/diaglite_wpf.zip

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
lightsundar99
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 15
Joined: Nov 15th, 2016
Re: WPF diagram from Silverlight diagram
Reply #7 - Feb 1st, 2017 at 1:26pm
Print Post  
Hi TroubleMaker,

We thought,
for WPF - MindFusion.Diagramming.Wpf is the dll...
Base class for Diagram is FrameworkElement.

But in your sample your are using DiagramLite.Wpf dll.
in this dll - Diagram base class is ContentControl..

What is the difference between both dll and I have to use common code for both WPF and Silverlight and its should have all classes and functionality same.

Please suggest me Which one I have to use.

Say for example :

ControlNode class is not there in Diagram.Wpf and its there in Both DiagramLite.Wpf and Diagram.Silverlight.

Why this difference and confusion.... please give me detailed information. so that it will be useful for our future purpose..
Since We are using some feature which is not there in silverlight, but its there in WPF. So, We are using Diagram.Wpf. What about DiagramLite.Wpf.
Example :
Exporting Diagram in Pdf format.
I understand that Exporting in Pdf format, We have to use different dll. But That dll is supported in this diagramLite.wpf dll. ?

Please give me detailed information

FYI : We are licensed user.
« Last Edit: Feb 2nd, 2017 at 5:29am by lightsundar99 »  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: WPF diagram from Silverlight diagram
Reply #8 - Feb 1st, 2017 at 1:42pm
Print Post  
The WPF diagram control has a completely different code base and uses low-level graphics APIs (DrawingContext class) to draw elements. Silverlight doesn't have DrawingContext class so back then we had to re-implement the Silverlight diagram using control templates, and DiagramItem inherits from ContentControl.

The Silverlight control was called diagramlite.dll back then so this diaglite.wpf.dll assembly name comes from it I guess. So it's a different WPF library built from same codebase as Silverlight, and not from the one of our original WPF control.

diaglite.wpf.dll should let you use the control templates and code you have from your Siverlight app without any changes. If you want to use the fully-featured WPF control from diagramming.wpf.dll, you will not be able to use same templates and there will be some tiny differences in the code-behind. I hope that makes things clear.
  
Back to top
 
IP Logged
 
lightsundar99
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 15
Joined: Nov 15th, 2016
Re: WPF diagram from Silverlight diagram
Reply #9 - Mar 3rd, 2017 at 1:06pm
Print Post  
Hi Team,
We have bought the license, can you please help me, where to download DiagramLite.wpf.dll. ?
Thanks,
Sundar
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: WPF diagram from Silverlight diagram
Reply #10 - Mar 3rd, 2017 at 1:32pm
Print Post  
It's still at the https://mindfusion.eu/_temp/diaglite_wpf.zip link from above. If what you need is to hide the trial label, note that we no longer provide separate trial and licensed builds, but instead you assign your license key string to the component's LicenseKey property.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
lightsundar99
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 15
Joined: Nov 15th, 2016
Re: WPF diagram from Silverlight diagram
Reply #11 - Mar 14th, 2017 at 6:19am
Print Post  
Hi Mindfusion,

I have few doubts .. in silverlight I can see
Selectionmoving and SelectedChanged and SelectionMoved events..
But I cant see these events in the given diagramLite dll...

Please guide me..
We have used all these events in silverlight and we want to use it in wpf also...
we are doing code sharing.
Please guide us to implement this.

Thanks,
Sundar M.

  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: WPF diagram from Silverlight diagram
Reply #12 - Mar 14th, 2017 at 7:47am
Print Post  
Hi,

I can see these events and they are raised correctly in my test, see attached image.

Regards,
Slavcho
  

wpf_lite_events.png ( 140 KB | 151 Downloads )
wpf_lite_events.png
Back to top
 
IP Logged
 
lightsundar99
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 15
Joined: Nov 15th, 2016
Re: WPF diagram from Silverlight diagram
Reply #13 - Mar 14th, 2017 at 9:34am
Print Post  
I am talking about Selection Moving.. not selection modfiying..
Please check and guide me..
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: WPF diagram from Silverlight diagram
Reply #14 - Mar 14th, 2017 at 10:19am
Print Post  
SelectionMoving was renamed to SelectionModifying in v3.1 of the Silverlight control (to reflect that multiple-resize does not just move). The WPF build was created from latest v3.2 of the Silverlight code, so you will need to upgrade your project to it if you want to use same source code, otherwise you'll have to use #ifdefs. You should have v3.2 on your account page after logging into 'clients area' from main page of our site.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint