WPF stands for Windows Presentation Foundation.It is a framework for developing windows applications using the .NET framework.It is a successor of MFC and Windows forms for the development of windows applications.
It provides several advantages over windows forms for developing desktop applications.It has the following features:
- It uses DirectX for rendering instead of GDI(which was used in windows forms applications)
- It uses XAML instead of C# for the development of GUI(which was used in windows forms applications)
- It uses dependency properties which provides additional services on top of CLR properties
When a windows forms application is run then their are few areas which the developer need to handle.
One is that windows forms application are not resolution independent.This means that the same application will be rendered differently on different devices.This is because windows applications uses pixels to render the UI.WPF applications on the other hand uses device independent pixels for rendering.This means that the same application UI will not be impacted based on the screen size.
Other problem which WPF solves is that it uses vector based graphics for rendering in comparison to the raster graphics used by windows forms applications.The problem with raster based graphics is that they loose clarity when resized.Also lot of memory is wasted when using raster graphics.
Another advantage of using WPF for windows applications is that WPF separates the UI and the application logics.The UI is developed using XAML as:
<Window x:Class="AppWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Grid> </Grid> </Window>
The logic for this UI is declared separately in the code behind as:
namespace WPFApp { public partial class AppWindow : Window { public AppWindow () { InitializeComponent(); } } }
Leave a Reply