WPF Vs Windows Forms
Introduction:
In my previous articles i explained what is wpf and wpf features, Architecture of WPF and Basic shapes and drawings in WPF and Various articles on Asp.Net and OopsConcepts.
Now i will explain differences between WPF and Windows Forms in-terms of their properties, events and methods.
Description:
WPF vs Windows Forms:
As earlier i explained in WPF features, We can say all that features are advantages of wpf over windows forms.
Now see the differences in simple terms:
WPF:
Pros:
- Powerfull styling and skinning structure is possible.
- Easy to create an own look and feel.
- Does support windows forms.
- Future technology for developing vista applications.
- we can reuse the code.
- Highly data binding is possible.
- Almost all features of HTML and Flash are available.
- Support fixed and flow format documents.
Cons:
- Declarative Vs Procedural Code.
- Required .Net Framework.
- Still in development Phase.
- Required Advanced Graphics.
Windows Forms:
Pros:
- Extensive documentation found on the internet.
- Plenty of examples.
- Does support WPF.
Cons:
- How long will it be supported( As i read in other sites microsoft stops further developing windows forms from 2.0, It is focusing on WPF).
- It requires lot of time and work to have good design.
Differences between Windows Forms and WPF in Properties,Methods,and Events for Control:
- In Windows Forms Controls like Button, RadioButton, Label, CheckBox and TextBox have Text Property to provide a caption for them but these controls have 'Content' Property in WPF.
- In Windows Forms to provide access key for a control with in that text of the control, the character to use as access key will be prefixed with & symbol but in WPF the character to provide as access key have to be prefixed(_) underscore with in the content property.
- In Windows Forms to use the TextBox for accepting the password you have to set password char property for it but in wpf there is no property for textbox and instead you have a separate control available for accepting the password that is PasswordBox.
- In Windows Forms applications controls have the Property Font to specify the Font, Font-Size, Font-Style but in WPF the Font property is splitted into multiple properties Font-Size, Font-Family,Font - Stretch, Font Style and Font Weight.
- In windows forms background color and foreground color properties are used to specify the background color and foreground color. But in WPF this properties are renamed as Background and Foreground which can be used to change the Background and Foreground colors and also Background and Foreground Images.
- Most of the Boolean properties in WPF are prefixed with Is. The property for CheckBox and RadioButton to determine whether or not it is checked 'IsChecked'.
- For the CheckBox and RadioButton the default event in Windows Forms is checked-changed, but in WPF checked changed event is not available for CheckBox and RadioButton and Instead of they have two events Checked and UnChecked, that will be raised whenever the RadioButton and CheckBox is checked and Unchecked.
- In Windows Forms there are three keyboard events key-down, key-up and key-press but in WPF there are only two keyboard events i.e key Down and Key Up and Key press is not available in WPF.
- In Window Forms whenever focus enter into control , Enter event will be raised and whenever focus leaves the control leave event will be raised. but these events were renamed in WPF as gotfocus and lostfocus.
- WPF provides a control called TextBlock that is similar to a label, which will not allow to
the text, but all the properties of the TextBlock are similar to a TextBox and not the label.
Conclusion:
These are all the differences in - terms features and properties,methods and events between WPF and Windows Forms.In my next article i will explain What are the layout controls available in WPF.
Don't forget to comment and share it for our friends if you like this post.Thank You.
No comments:
Post a Comment
Please Give your Valuable Suggestions,Questions and Comments to improve my blog.