From WPF Control to Silverlight Control - wpf

we have biuld a complex custom control for WPF.
Now we are going to port our control to Silverlight.
Me and my collaborator, never work with silverlight! :)
Is there some best practice to follow to make a porting activity from WPF to Silverlight?

I find the next post as nice to be read: (2 parts)
Porting from WPF to Silverlight: The Missing Pieces, Part 1
Porting from WPF to Silverlight: The Missing Pieces, Part 2

There are some differences to be aware of, for example there are no Routed Commands in Silverlight. Maybe you want to have a look at those two links:
Contrasting Silverlight and WPF
Guidance on Differences Between WPF and Silverlight

Related

XAML, WPF and Windows 8

I'm hoping someone here can explain to me the difference between WPF and XAML exactly in this context:
I have an application (an XBAP specifically) written in VB.NET using MVVM & Repository Pattern, implementing the the usual INotifyPropertyChanged, OLEDB etc etc.
The front end of the application is written in XAML.
From what I understand there is nothing specifically "WPF" about this application. In my view its XAML + VB.NET; where does the WPF come in? Given windows 8 and the "death of Silverlight/WPF" that I keep hearing about, what should I be doing to "upgrade" my application to ensure its future?
I would greatly appreciate someone clearing up this confusion for me.
XAML + your code behind is WPF. You are using WPF. XAML is the markup used for defining the interface in WPF.
And I wouldn't worry too much at this point about "the death of Silverlight/WPF". Just because Windows 8 supports HTML5/JavaScript doesn't mean WPF has gone away. At least, not yet.
See also.
An XBAP (XAML Browser Application) is a kind of WPF XAML application, that runs in the browser. Nothing more, nothing less.
WPF isn't going away anytime soon; in fact, it received a number of enhancements in .NET 4.5. Windows 8 will continue supporting WPF whether it's run on the desktop or as an XBAP. There's no need to "upgrade" your app, but if you want to take advantage of the Windows Store and the new user interface, it's not difficult to port your WPF XAML to WinRT XAML.
See, WPF can be called as the Successor of WinForms . In WPF WE have this XAML that is simply XML but Is more powerful and has greater properties .
WPF isn't dead !
Talking about Windows Store Apps, Silverlight has lots to do with WPF and XAML
Your XBAP application uses WPF : XAML for the UI and VB.NET for the code behind.
If you want to be sure, check if the namespaces you use in the code begin with "System.Windows".
Your XBAP is just a kind of project you can create with the WPF technology. (that's an application which shows several web pages as its UI).

WPF control and windows normal control

In a WinForms project there are a number of controls such as MenuStrip, OpenFileDialog, SaveFileDialog.
After a quick look, I can't seem to see the equivalents for these controls in the WPF toolbox.
Is there any way to gain access to these or do they exist in another form?
There are a number of different resources you can use for finding the type of control you need.
Have you looked in the WPF Toolkit?
Have you investigated any third party control vendors?
(Telerik, DevExpress, ComponentOne, Infragistics)
Here's an excellent link comparing the WinForms and WPF control equivalents.
You'd probably recieve a more detailed answer if you gave specifics as to which control you're looking for.
you can add a winforms host into the project but which controls are you after as the wpf does have a decent amount of controls and generally does more in the ui department (but pays in speed usually)

wpf vs winforms by means of customizeable UI

Which technology (WPF or Winforms) should be used if UI supposed to be highly customizable like controls layout/design could be change by user and such sort of UI customization.
Kindly mention best practices along to achieve that...
I just recently developed a designer in both WinForms (company req) and WPF (to see how much better it was). WPF has a definate edge, especially when it comes to nicer looking controls and control transparency.
This was my first actual WPF project, other than just messing around, so I was learning as I went. I found this series on creating a diagram designer very helpful. I didn't really do the same things that this article talks about, but more of a hybrid between that and my WinForms app.
I have to admit that the UI functionality was up and running much faster in the WPF version than with the WinForms version.
WPF I have found the easiest to create controls on a fly. Because I can just attach them as child controls to the parent, and the Grids, Dock Panels, just make life easier.
I found WinForms to be clunky to always work with. However I come from a Web background and Xaml makes sense to me.
WPF controls are design and lookless. That means you have a default view of them, but everything detail of a WPF control can be overridden. It's almost akin to using CSS. In the WPF world, you do not create custom controls like you do in WinForms. The main thing in WPF world is "styling" controls and defining a style for them. It just happens that the style also controls the layout and the form of the controls.
WPF is FAR superior for designing and style of UI. Check out these two top WPF companies and tell me if this stuff is easy to do in WinForms:
Cynergy Systems: http://www.cynergysystems.com/
Thirteen23: http://www.thirteen23.com/

Are there good WPF control libraries out there?

Do you know any good WPF control library (even commercial) and what experiences have you made with them?
Telerik has a commercial line of WPF controls, as well as WinForms, and Silverlight. They are very high quality, and on the high end in terms of $$$, but they're worth their weight in gold if you're going to utilize them.
I've used their web products and they are well made. They even have sample code on their site and demos so you can get started easily.
Odyssey is a nice set of controls with a Ribbon menu control and Outlook-style bars.
You may have problems using them in XBAP applications though.
DevExpress have a rich set as well.
Infragistics has some excellent WPF and WinForm controls (commercial). I'll admit I have only used their WinForm controls, but if their WPF controls are anything similar, they will be great.

Can WPF and WinForms be mixed within an application?

Can both WPF and Windows forms controls be used within one application? How difficult or practical an idea is this?
It is fairly straightforward to host WPF controls in a WinForms app with an ElementHost adapter or WinForms controls in a WPF app with a WindowsFormsHost adapter. There are not too many resources on the web showing how to do either of these, however. In the process of learning how to do this for myself I quickly discovered the inherent symmetries between the two pathways. I distilled all my notes into an article comparing and contrasting these symmetries using a unique approach: the article is really two side-by-side articles, comparing every step in detail, starting from creating a user control in one technology to hosting it in an application in the "opposite" technology. My article, published on SimpleTalk.com in August 2010 is available here: Mixing WPF and WinForms.
For completeness, here are a couple good MSDN references, one for each pathway. In fact, the demo solution accompanying my article started from both of these:
Hosting a Windows Forms Composite Control in WPF
Hosting a WPF Control in Windows Forms
I believe there is a WindowsFormsHost control you can put in your WPF apps which will do interop back to WinForms code:
http://blogs.msdn.com/ivo_manolov/archive/2007/07/26/wpf-win32-interop-part-1-hosting-winforms-controls-in-wpf-windows.aspx
We hosted significantly complex WPF controls in an existing LOB WinForms app. It can be done, but we did have issues (some no doubt caused by the steep learning curve). These primarily had to do with loss-of-focus events not being fired when expected, and also keyboard navigation issues.
You can also use an HWNDSource and HWNDHost controls to embed WPF controls in a WinForms (or any Win32, really) app.
When hosting non-WPF content (Be it HTML, WinForms, or Win32 content), you will haveAirspace issues. This means you can't completely compost the WPF content with the hosted content. You also can't animate it etc. There are some interesting issues with respect to scrollviewers see here for more details and a fix also.
Yes you can, both Windows Forms within a WPF application, and WPF controls within Windows Forms. www.novamind.com's mind-mapping application is a successful mix of the two technologies.

Resources