Switching to WPF. Is it time? - wpf

I'm considering switching from MFC to WPF.
My first concern is that there are too many users who don't have .NET with WPF installed yet. Can anybody point to a source containing the WPF penetration numbers?
My second concern is speed.
Any other considerations?

I've been banging away at WPF for a while now. It is brilliant, but it still has (occasional) holes you've to plug yourself. However all indications are .NET 4.0 will be a significant step forward.
I would say start now. The WPF learning curve is REALLY steep, and it'll be a while before you'll be releasing software to users, believe me. Also do yourself a favour and get the WPF Unleashed book. It's superior.
Speed isn't a consideration. The power WPF gives is well worth any drawbacks with speed, which - coming from Windows Forms - I haven't noticed to be honest.

What kind of application are you developing? If it's a wide-distribution desktop app that you want your grandmother to install, your concern about .NET 3.0/3.5 adoption is valid. So far from what I've seen, performance is less of a concern.

WPF penetration
First of all, Windows Vista and Windows 7 both have WPF preinstalled, which accounts for 35% of the market automatically. Windows XP has had it as it had .NET Framework 3.0 as an option in Windows Update for over three years, and many applications ship with it, so it is likely to also be installed on a high percentage of Windows XP machines. StatOwl indicates that about 80% of NET Framework installations are version 3 or above.
If you're shipping on CD it is no big deal to include the latest .NET Framework on the CD and have it install automatically. If users are downloading your application, it can contact Microsoft's web server to download and install the latest .NET Framework. Online ClickOnce deployment also has this capability if you want people to be able to start their application directly from the web browser without installing it.
So the bottom line is, you probably don't need to worry about whether people will have WPF installed on their machines or not unless your target market consists primarily of dial up customers on Windows XP who don't run much third-party software (i.e., they just run Windows and your application).
Speed
Not an issue. I have a 200 MHz Pentium Pro with 384 MB RAM from 1998 that I test my software on, and my WPF applications have comparable performance with equivalent MFC applications. If your WPF application uses lots of fancy graphics and animation it will run slowly on ancient CPUs and graphics cards, but so would an ordinary MFC application with the same features.

Don't even bother trying to use WPF if you are sticking with Visual Studio 2008 for the next year or two. The experience will be way too painful. I'm talking about "my IDE crashed again" type of pain.
If you are going to use VS 2010 in the near future, then WPF is a blast. Download the beta, a couple of themes off CodePlex, are start playing. Once you get past the (freaking huge) learning curve I think you will find it to be quite enjoyable.

IMHO, you should wait for Visual Studio 2010 and WPF 4.0 to make the actual migration. They will close some very annoying gaps in the product.
Meanwhile, you can try it out. In terms of coding/readability -- it's going to be WAAAY better than with MFC =)
As for the performance and platform -- it shouldn't be a problem unless you have any very special circumstances (like if you can't require users to install .NET).
Also see this related question on switching to WPF from Windows Forms.

If you are thinking about a larger, modular, appliation I recommend checking out Prism. It's a bit of a beast itself, but you should be able to tackle it after coming to grips with C#, Dependency Properties and XAML. Plus, learning Prism gave me a much better understanding of WPF/Silverlight, at least from the development/binding side.
Mike Taulty posted an excellent 10 part video series on Prism. It's a great way to get your head around the platform.
I'd also recommend the pages linked to from the Getting Started page on codeplex. After all that, you're probably ready to tackle the Reference Implementation which comes with the download.
A previous answer of mine might also help clear up any remaining confusion around Controllers/Presenters in the framework that you might have (I did).

Related

Development trends of Business apps in WPF now a days

I have asked this question several time form many developers about the future of WPF in 2015 and in coming years. Someone told me that Microsoft is interested to take this technology in the future also.
Actually i like to develop enterprise and LOB business application in Winforms and now want to move to WPF. Time is short and i need a concrete answer that should i invest my time in WPF or not? If the answer is not then what is the new Microsoft tool to develop business application like Point of sales applications and other large database business applications. I have a keen of new technologies so i don't want to invest my time and money in old technologies. If Microsoft is also not interested in these technologies then i am not also.
So please anyone can tell me that what is the best and new suitable technologies to create business application now a days from Microsoft?
Thanks.
I'll chime in.
This is a tricky conversation because we are on the verge of Windows 10. Let’s start out talking about Windows 8. WinRT XAML for Windows 8 is certainly not ready for you to use it out-of-the-box for to create a full-featured, LOB application. There are too many things missing like validation, windowing, and advanced binding. The Ent. app was not it's primary mission.
On the other hand, WinRT XAML for Windows 8 is perfectly suited for creating a companion, touch-first app that delivers value to tablet-based or phone-based users who would interact with your app in a more limited way – like reporting or workflow. I talk about this more here:
http://blog.jerrynixon.com/2012/08/windows-8-apps-whats-enterprise-to-do.html
WPF is a different story. WPF is proven, right? It totally is. There’s nothing you can dream up that WPF can’t do great. No line-of-business requirement holds it down. It's awesome. What’s more, is that WPF runs on Windows XP, Windows 7, Windows 8, and soon Windows 10. That’s a lot of operating system options.
The future of WPF is quite bright, too. The team is reinvigorated and the improvements slated this year and the new tooling for XAML developers makes it an even better experience. I talk about that more with the WPF team here:
http://blog.jerrynixon.com/2014/11/hey-future-of-wpf.html
WinRT XAML for Windows 10 is different. For one, it’s not going to be an operating system-based system. That means, more like .Net, you just target the framework you require installed and go from there. It is also more fully tooled to compete with the fidelity of WPF XAML to build LOB apps.
But with WinRT XAML for Windows 10 you have to ask yourself how many people will be running Windows 10 because it will not work on previous versions of Windows. Since Windows 10 will offer itself as a free upgrade for the first year, you could argue that many will be running Windows 10, but since the Enterprise version of Windows 10 is not part of that deal, you can only determine that by knowing your IT roadmap. Nobody can do that for you.
All things being equal, if you are simply trying to choose between WinRT XAML for Windows 10 and WPF today, you will choose WPF. Once you have an adequate install base of Windows 10, I think most LOB developers are going to be surprised how tempting an option Windows 10 is. The future of WPF is solid. But the most significant investment into UI technologies at Microsoft is, hands down, WinRT XAML for Windows 10. Does that mean WPF is not future-proof? Of course not. I would choose WPF without any hesitation, as I have done for years.
Best of luck!
Anything can be a gamble, especially with Ms. They (and Intel) tend to throw darts at a wall and when one sticks, it marks the current direction for the week.
According to Microsoft WPF never went away. They forget to tell many employees that. For a while XAML was so very WPF like it was almost the same thing, and for a point of sale system, it seems like if you are going a Microsoft direction, XAML would be the better choice. But again, it is almost the same thing; Windows store app with XAML as opposed to desktop app with WPF. But the direction of the week is yes WPF will go forward and even possibly be Ms strategy for cross platform.
But I would also really ask is Microsoft the right choice for your target? I would think heavily about Android. Not so much just Java, last I looked their roadmap had wpf like functionality targeted for 2024. Or iOS as I don't expect to see Apple sell a cash register anytime soon, so I doubt if they will ever be in the Point of Sale business.
I did a fairly big Point of Sale system a long long time ago. Actually 2 of them. With what I know I would target XAML/Store apps today. But it is about a 51/49 split with Android in my mind. If the customer wanted Android, I would not argue very much.

Windows Phone 8.1 Store VS Windows Phone 8.1 Silverlight

When I create new Windows Phone project I have an option to create a "Windows Phone" or "Windows Phone Silverlight" app. I know that they have different runtimes and different APIs.
I was under the impression that Microsoft wants to unify Windows and Windows Phone platforms so why is there even a Silverlight version? What benefits does it bring?
Also, if I want to create an app just for Windows Phone and never have plans to bring it to Windows, what should I choose, Silverlight or Windows Phone?
I'd suggest you go with "Windows Phone" (non-Silverlight). It's the new API, which works for both Windows and Windows Phone. At some point you may want to port the app or create a new one for Windows and you'll already know the API (and porting will be way easier). Also, the new API will most likely get more updates and features added, and at some point you may even be forced to update to it (either because the old one is no longer supported, or because it does not have some features that you need).
As it was said in the other answers - the Silverlight option is there only for backward compatibility and is likely to be phased out in time. That is - it's good if you already know the API and have many libraries (yours or others) for WP Silverlight, but if you're just starting - you'd better go for the new technology.
Edit
There is one other thing to consider before choosing between the two types of apps. Some features are only available in a Silverlight app, and others (smaller amount) - only in a Xaml app. Here's an article with some info on the differences: Migrating your Windows Phone 8 app to a Windows Runtime XAML app
Windows RT Xaml is quite new and People have to generate some knowledge first.
Silverlight for phone has been around for years and there's a load of tools available: Phone Toolkit, diverse Controls, etc.
Just killing it off would have hurt many developers who built up intellectual property over a long time forcing them to start over.
When starting a project with Silverlight you will have more things around that help you get stuff done.
When starting with WinRT Xaml, you will have better performance, but will have to figure a lot out by yourself.
So the Silverlight option is there to not throw of Silverlight developers.
I recently started a new project on WinRT Xaml and my experience was that I had to recreate a lot of common tools like Caches, etc. But also a lot of things that were in Toolkits previously are now part of the platform itself. Also, when moving over to Windows 8, you get to share a lot of code which is nice.
Unifying the environment(s) would be ideal. In my opinion, it hasn't been very successful. At one point in time, you could only develop under Silverlight, so what you are seeing is just a newer version of the same thing to keep backwards compatibility as well as to keep Silverlight's developers happy. In the future, it will probably be phased out. Plus if you want to support older Phones, Silverlight is basically your only choice (you'll be surprise, how many WP users haven't updated their 8.0 to 8.1)
There really isn't any other real benefit of Silverlight other than maybe the Windows Phone Toolkit which has been tremendously useful (you can see how many SO's answers rely on this simple addon). Once the universal runtime gets fleshed out to the point where the documentation reflects what's actually available -- then I think it would be the default project for developing in Windows going forward.
If you're just starting, I would use Silverlight the knowledge based is much greater. After you get use to the WP environment then switch to runtime.

Mcafee update blocked silverlight and the future of the Silverlight Technology

Today, while I'm running a Silverlight project in the Internet Explorer by pressing F5 in Visual Studio 2012 in my Windows 8 machine, I found that McAfee started to block Silverlight XAPs (Which is loaded by Prism).
This leads me to think again about the future of Silverlight. I'm at the beginning of my LOB Application. Should I stop what I like to work in Silverlight and return back to WPF. I which that I can continue to develop in Silverlight until Windows 8 becomes rich like Silverlight. That is why I limit the Model and MVVM to PCL to be easier to be ported to WinRT in the future. Using await async and so...
Please advise me which is better for a LOB application that will run in three countries throw the Internet. Should I continue in Silverlight for zero deployment, or work in WPF or even Windows Forms and use clickonce?
The fact that McAffee blocked something has NOTHING to do with it's long term future. McAfee is nobody, they don't determine whether or not a specific technology can be used or not, or will be used in the future.
Silverlight seems to have reached a dead end, due to Microsoft realizing that if they create a multi-platform application environment, people might just stop using Windows.
WPF also seems to have been abandoned in favor or WinRT XAML, but of course WinRT XAML is not an option for us developers at the moment, simply because it is Windows 8-only, and our customers don't have Windows 8 or greater.
Besides, technically, WinRT-XAML seems to be really inferior to WPF XAML, and lacks many important features.
Of course winforms is completely useless and is not an option, unless you need to run your applications in my grandma's 80386 computer with an Hercules monochrome monitor
(exaggeration).
Seriously, that dead technology is not the answer to any of today's challenges. Things that you can do easily in any of the XAML-based technologies are either impossible or require a bunch of horrible hacks in winforms.
I suppose the definitive answer depends a lot on the usage scenario, for example:
Silverlight makes more sense if you have to publish your application in a web site and have anyone download it and use it.
WinRT XAML makes sense only if you target Windows 8, or want to create 'metro style' apps.
WPF makes sense if you want to create Windows Desktop applications, and have them deployed via ClickOnce or Windows Installer to a more limited and controlled set of users (because it needs installation of the .Net Framework, which Click-Once can deal with anyways).
winforms makes no sense whatsoever because it's a completely useless dinosaur technology that doesn't support anything.
Thank you very much for your answer and sharing your experience with me. I always try keeping WinRT as a strategy planning for each line of code I write. As I wish to migrate my code easily to WinRT in the future. The future is translated to me as may be within two years I may find myself in a situation that we will be targeted to migrate to something like Windows 9.
The best successful migration scenario - as I wish, it could be by increasing the usage of PCL at the client side as much as possible and test in a small piece of WinRT module.
We hope that Microsoft succeed in Windows 9.
I am sadly decided to shift to WPF instead of Silverlight in case that Silverlight depends on browsers that may not be supported in the future. As we here that Chrome, Safari and others are stopping supporting Silverlight. Why should I insist in relaying with such great technology that is dead before it finishes.
The main difficulties I could face in the future migration could be tied to two patterns:
- Prism.Regions: Windows Store has better than that.
- Prism.Modularity: Windows Store has no migration strategy to that.
At least at the moment I'm writing my thoughts Prism for Windows Store are far from implementing Regions and Modularity.
This is not a final answer but a clue of my what I should and should not to do.

WPF or Silverlight which one has the upper hand?

I am Really confused by reading some articles about Silverlight. Whether I should concentrate on WPF or Silverlight or Both?.
It's like asking Web or Desktop : Which one has upper hand?
Silverlight (Web) and WPF (Desktop) Both are similar. But both have their separate workplaces.
You cannot have a Windows Calculator, Task Manager or MS Word (please don't mention google docs) applications on web like they are on desktop. And same thing applies for web applications.
So, it depends on what platform you want to work on.
I dont think its difference between Web and Desktop. Silverlight is still pretty limited by platform it can run on and still requires some local runing process, even in the sandbox.
I think difference here is features vs availability. WPF can give you features of whole .NET framework, total acess to users's computer and some features that are not available in SL. SL on the other hand allows you to run your app on some different systems (Windows, Mac and there is limited support for Linux-based systems), distribution is much easier thanks to web deployment and whole application can be part of your web ecosystem.
Iam personaly for WPF, but thanks to this whole web and cloud-hype in the last years, SL is getting much more attention from side of MS and developers in general.
Reading these questions and their answers may give you some insight into this:
Definitive source(s) for the difference between Silverlight and WPF
https://stackoverflow.com/questions/1254937/wpf-vs-silverlight
What is the difference between WPF and Silverlight?
I totally agree with decyclone, it depends on which platform you want to work. If you have prior experience Asp.net/We applications Silverlight is the way whereas if you have worked in WinForms/Windows applications then WPF is the way to go.
But yes most of the concepts in both SL and WPF are similar; so once you have good understanding of those concepts, you work in either without much problem.
If we ignore the platform then WPF is having the upper hand as WPF is kind of superset of SL.
Have a look at this SO question too -
Learn Silverlight or WPF first?

Windows Forms Dead. Long life to WPF

In PDC sessions i see only Framework 4.0, Azure and WPF.
My all applications is in windows forms and asp.net (codebehind) and framework 2.0 or 3.5. I see i'am obsolete, ok. But my questions is Windows Forms is dead, i need start migrate to WPF or Silverlight? or my Windows forms with Devexpress can leave more than 3 years?
It's not really dead or alive -- more like undead.
I don't think I'd say WinForms is dead... is DOS dead? Do you ever write a console app? There's way to many programs out there on Windows (really the majority of them) that use WinForms for it to just die. Remember Y2K and all those systems needing to be updated from Cobol (or was it Fortran?). Personally, I'm migrating to WPF, but there's still a time and place for WinForms I believe... C++ is still being used even though we all have C# now, kind of the same concept I think.
I've just installed VS2010 C# Express edition and there's still the option to create a WinForms project. I expect that the options still there in the full version too (I'm currently without an MSDN subscription so I can't get it at the moment).
So I think that there's still life in the technology.
By all means move to WPF or Silverlight, but do it because they offer you something you can't get from WinForms.
Windows Forms is no more dead than VBScript is dead. And I'm currently working with some fairly atrocious classic ASP VBSCript code, so I can assure you, it's not dead either (alas).
Win Forms will be around pretty much until Microsoft drops Win32 entirely, and even then it'll still be around in legacy systems for several more years.
Well, there are many differences between these two and probably it would be a good idea to establish some roadmap in order to migrate your application. There are many hundreds of websites for their comparison, but in order to answer your question, I suggest to start a new branch and start migrating while supporting your current models. With your current one you wouldn't have that much of problems either.

Resources