Why switch to WPF for a business application instead of using Winforms

Our team has experienced work on Winforms and ASP.net projects.

Like other programmers in stack programming, I recommend that I switch to WPF for our next team, and not use WinForms for our client business applications.

Now I'm starting to develop my first project using WPF, for me it is a little difficult for me, since this is my first attempt to use this.

Can you give much deeper information on why we need to jump to WPF instead of using winforms?

I need to convince our manager that we can dig into WPF for our client projects.

We are using VS 2008.

+7
source share
3 answers
  • Take a good MVVM Framework. I personally use Microsoft Prism . For other alternatives, check out this StackOverflow question .

  • Routed events are for viewing only. For example, if you want to scroll to the end of a multi-line text field when changing text.

  • Commands are used to bind events in which the logic is located on the presentation model (business logic) ... For example, the submit button.

  • If you have designers on your team, ask them to start playing with Expression Blend and understand the styles / layout. Expression Blend allows you to use sample data to view the layout of applications without having to run it all the time.

  • Understand the difference between ContentControl and ContentPresenter .

  • Understand how ItemsControl works. There is a difference between SelectedItem , SelectedValue and SelectedValuePath .

  • Look at the many illustrations on the Internet. Dr. Wpf , WPFTutorial.net , Josh Smith on WPF , etc.

  • If you plan to use UI code testing (to test the actual user interface), be sure to specify controls that matter (most MVVM guides tell you that you don’t need to specify any controls) If you do not plan to run Coded UI Testing, then do not name your controls unless you need to reference them from the view itself.

  • IValueConverter and IMultiValueConverter should only be used to convert properties into viewing-related items. The most commonly used converter is the BooleanToVisiblity converter.

  • TargetNullValue , FallbackValue and StringFormat are important when using bindings. Do not make assumptions that anchored data will always be available and corrected.

  • You almost always set ObservableCollection<T> or ReadOnlyObservableCollection<T> from your view models. Very rarely do you ever return any other type of collection, including IEnumerable<T> .

  • BindingMode caution when choosing BindingMode : OneWay , OneTime , TwoWay , OneWayToSource (WARNING: OneWayToSource is complicated ... it still requires a getter because it is not write-only binding).

  • A good debugging tool that is free is Snoop . It looks like a DOM explorer for starting a WPF application. A more advanced (and not free) tool that is slightly more powerful is Mole .

That's all I can think of now ... Oh, and if you run into road blocks, StackOverflow is your friend :)

+8
source

I wrote a series in WPF with MVVM , specifically designed for developers who have a Windows Forms background, and are planning on moving to ship.

He takes a look at some of the basics of WPF, demonstrating how it allows you to approach your development differently from Windows Forms, including introducing (softly) templates, commands, and other concepts that are associated with significantly superior data binding in WPF.

This will provide a good introduction to WPF and show you why it might be better for business applications than Windows Forms.

+4
source

For those who read and wonder β€œwhy WPF” instead of Winforms, the answer is that binding WPF data makes it a lot easier. MVVM really just helps you get the most out of it, but you don't need it.

As someone who is currently studying, I would recommend just using WPF to start, open a project and start doing what you did in WinForms, manually setting properties and handling events. This will work. But as soon as you find out that WPF does this automatically for you, you will suddenly start to resent the old way, and you will end the path to MVVM.

+2
source

All Articles