Silverlight to WPF Converter - c#

Since WPF and Silverlight are very close to each other(in terms of syntax).
My query is , do we have any tool that can convert wpf control to silverlight control and vice versa.
I understand that everything in WPF shall not be expected to run on Silverlight, but since the come from the same code base, is aconversion possible.

In theory you could write a converter that would work in many cases but it would never work in all cases because the two implementations are not completely compatible. That being the case there would likely be so many issues it could not automatically solve at conversion it would be quicker to just port it manually instead. That is probably why there are no converters available. Not to mention that there is little demand for such a tool.

WPF controls are built on top of the full .Net.
Silverlight controls are built on top of a subset of .Net.
If the WPF controls were restricted in their use of .Net then it is feasible that a conversion would be possible, but quite frankly I think there would be too many exceptions to make it worthwhile.
Where we need to share code (not controls) between WPF & Silverlight we "link" to files from a common library (the library is only a repository and not built). The Xaml we can cut & paste.

Related

Embed html in C# Forms

Is there a way to embed HTML into a windows forms custom usercontrol? I want to create a lightweight control to be used in a .NET 4.0 application, but since the contents of it is viable to change, I was thinking using HTML to lay it out might be easiest. Is there a way to achieve this in windows forms? There are some other topics with C# and HTML but pretty sure non involves creating a control that parses HTML and displays it.
Thanks
You could use a WebBrowser, but I'd recommend not going down that path. Just use traditional controls to accomplish what you need, if at all possible, maybe combined with a little GDI+.
A WebBrowser would be your best bet in terms of ease of use and maintenance. You can have further control over the contents themselves by accessing the browser.Document.DomDocument interfaces and events. I would not recommend using GDI since it can become a pain to maintain and manage custom rendering in the long run.
I have been trying to do a similar thing and have found awesomium. They have a dotnet and mono wrapper and quite fine grain control over the whole thing acts. It is also free as long as your company makes less than 100k a year.
Forgot to mention it is a browser that you basically embed in your application so you don't need to worry about the user not having it installed or anything and is consistant over pc's and OS's

C# / WPF - Is it feasible to recompile the SilverLight 4 toolkit for use in a WPF App?

I really like some of the pre-built controls available in the Silverlight 4 Toolkit
I understand the CLRs are different but I was hoping that I could download the source and recompile for the CLR that WPF uses.
Is this possible? The WPF Toolkit is very basic by comparison and doesn't have encouraging reviews.
Many Thanks.
Have you looked at the Extended WPF Toolkit: http://wpftoolkit.codeplex.com/
Well, both WPF and Silverlight uses the same CLR version (runtime v2 or v4). The difference is in these two frameworks (libraries) theirselves.
Theoretically, it's possible, but depends on concrete code.
This might help:
Differences
Code reuse in WPF and Silverlight
It is certainly possible, but you won't be able to recompile for WPF. You'd need to create brand new project files (csproj) for WPF or convert the existing ones manually.
In addition, you'd have to target WPF 4, since the Silverlight toolkit makes heavy use of the VisualStateManager. Or you could get the VisualStateManager from the WPF toolkit, and target WPF 3.5 SP1.
There are going to be several supporting classes and/or class members in the Silverlight toolkit, which are not needed in WPF. Such as controls that mimic the IsMouseOver property using MouseEnter/MouseLeave events. These would need to be removed and updated to leverage the WPF version.
After doing all that, it should compile for WPF. You may run into some issues during runtime though, due to quirks with differences in the frameworks. Each of these would have to addressed individually.

In what language these are made

I have seen some applications having such a rich layout that a person starts hating desktop applications like traditional c#.I was wondering how to make applications having GUI like this is it possible to make it in c#?
According to the title, this uses WPF, which can be used with C# and/or XAML. It can actually be used with any .NET language.
The problem is not the programming language. What you need is:
a UI framework that allows rich layouts (in C#, you'd use WPF),
and, even more important, a designer. With "designer", I mean a human, not a tool. If you look at your screenshot, you will notice that the colors of the background image match those of the buttons, that the buttons match the content circle, that the header of the content circle ("Getting Started") matches the header of the window.
So, really, this is not a matter of programming language. What you need is a design. Implementing it is the easy part (at least with technologies such as WPF).
Look at the window title... "Xceed DataGrid for WPF Recource Center". I might be going out on a limb here, but I'm guessing that it was written using WPF and C#.
Only the developers know for sure! Okay, the window title gives it away
Quick guess, they're using Windows Presentation Foundation, which isn't a language, but part of the .NET Framework (starting with 3.0).
Adding some resources here . . .
You have to use WPF for that, and probably with some custom controls.
For WPF have a look here:
Wikipedia
MSDN
Expression Studio
For already made controls you can check:
Xceed
Infragistics
Devexpress
There are a lot more out there even a lot of free ones. All the above are commercial but i think they have a few free samples.

Are Visio-Like WPF GUI's possible?

I want to create buttons and displays in WPF that look something like the Visio Flow Chart displays. Are there classes for that?
Here's a series of articles which show you how to create a drag'n'drop flow chart designer in WPF:
http://www.codeproject.com/KB/WPF/WPFDiagramDesigner_Part4.aspx
The problem with that particular implementation (WPF Diagram Designer on Code Project) is that it is not MVVM based and generally doesn't use an architecture that is flexible or extensible to further development (e.g. just wanting to add Undo/Redo support would argue for a rewrite). It does, however, include a path finding algorithm (though in production use I fear it may be a little buggy).
I would recommend looking at the WpfDesigner.* assemblies in the SharpDevelop project (it's open source) and the WPF DrawTools on Code Project (http://www.codeproject.com/Articles/22776/WPF-DrawTools). The architectures of both of these are at least somewhat amenable to further development. Just ensure the licensing is compatible with your use, particularly for SharpDevelop.
I found http://www.codeproject.com/Articles/182683/NetworkView-A-WPF-custom-control-for-visualizing-a quite good. You would need to extend it with some UI templates to get the shapes you want and perhaps change the connector attachment scheme to fixed locations.

What is Silverlight's relationship -- if any -- to WPF?

I was working with a WPF application and I decided that the controls and graphics I wanted to display on the grid might look better if it was a silverlight component.
I thought this way because of all the cool silverlight controls that look very flash-like.
But now that I have gottem my Visual Studio 2010 set up with SIlverlight, it seems that every silverlight app I can make are ASP.NET in nature. It seems that instead of a cool GUI control to make, Silverlight is telling me that it is primarely a dataflow sort of application for the web.
What is the relationship, if any, between WPF and Silverlight. Can I or can I not put a silverlight control into my existing WPF application?
It's my understanding that Silverlight is like "WPF lite", and that in many ways they are almost the same thing but made for different purposes (desktop vs. web). If you want your wpf application to have a different look, you don't need to bring in any other controls from silverlight, because you can simply re-style or re-template them to suit your needs (which you can also do in silverlight). But you can't simply use silverlight controls in wpf because they're compiled to run on different runtimes.
Silverlight does have a number of un-official controls in the silverlight toolkit which are not included in wpf or the wpf toolkit. They are open source, and if you really want, you could port them to wpf, especially since the code is very similar to wpf.
Silverlight is essentially a subset of WPF that is used to create web-based applications.
You might be able to jump through some hoops to get a limited Silverlight application running in WPF, but I doubt it would be worth it...
I know others may point out that SL is WPF lite.
But hope you find out they are different frameworks at least right now though they share XAML, and a similar model.
Not sure if in the future they become the same, but keep the differences in mind is critical at this moment. :)
We know DevExpress is now shipping the same code base of their components for WPF and SL, but that does come after putting a lot of efforts.
http://community.devexpress.com/blogs/ctodx/archive/2010/04/20/merging-our-silverlight-and-wpf-ui-controls.aspx

Categories

Resources