Advantages of WPF Over WinForms in VB.NET

Advantages of WPF over WinForms.
  • 3457
 

Advantages of WPF has over WinForms:

  • Having the interface in XAML makes it so much easier to fine tune all those obscure properties or to cut and paste a whole section of one control into another.

  • WPF makes it a lot easier to modularise an interface, breaking a screen down control by control. Forms can do the same to an extent but I always found it a battle.

  • Some of the bells and whistles are cool. I've found the use of animations (storyboards) really useful for data entry screens where you need different entry boxes depending on which product is chosen or such. With Forms you'd have to create a separate panel/form for each data entry screen, with WPF I use an animation to hide and move the various text boxes around.

  • It is dirt simple to write Custom Controls with WPF. where as custom control writing in Winforms is very challenging.

  • With expression blend and WPF Building UI is more productive in comparison to win forms.

  • You can change the look and feel of a WPF application far easier than you can a WinForms application.

WPF vs WinForms- In Controls 

ListBox
 :-WPF is the clear winner. This was turned from an unexciting to a really great control.

ComboBox :-Again WPF is the clear Winner.

TreeView :- I like the WPF treeview better as it is much more flexible but the WinForms one is significantly easier to use. I would call this one a tossup.

RichTextbox :- The WPF Richtextbox is glacially slow in comparison to the Winforms one. Even though it has more flexibility the winforms one is better. 

Grids :â€" WPF is not as advanced in the grid department, but the WPF grid scene is definitely improving. On the other hand it seems like third party Grids are the rule rather than the exception, and some of the WinForms ones are very good. I worked quite a bit with FlyGrid which is astonishingly fast; another one for WinForms.

Example:-Working of Progressbar Showing for WinFormsApplication and also for WPF

WinForms Example:

Public Class Form1
Private Sub Form1_Load(ByVal sender As System.ObjectByVal e As System.EventArgsHandlesMyBase.Load
 ProgressBar1.Minimum = 0
 ProgressBar1.Maximum = 100
 ProgressBar1.Value = 0
 ProgressBar1.Value += 2
If
 ProgressBar1.Value >= 100 Then
 
ProgressBar1.Value = 0
End
 If
 End
 Sub
Private
 Sub Timer1_Tick(ByVal sender As System.ObjectByVal e As System.EventArgsHandlesTimer1.Tick
  ProgressBar1.Value += 2
If
 ProgressBar1.Value >= 100 Then
  
ProgressBar1.Value = 0
End
 If
 End
 
Sub
   End Class

Output:

Winforms.gif
 

WPF Application Example:

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width
="525">
<Grid>
<
ProgressBar Height="26" HorizontalAlignment="Left"         Margin="158,48,0,0"Name="ProgressBar1"VerticalAlignment="Top" Width="222"  Value="60"/>
</Grid>
  </
Window>

Output:

WPFapplication.gif
  

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.