Windows Presentation Foundation(WPF)

WPF is a platform used to develop and run visually rich .NET applications. WPf comprises these two elements:

  1. DLLs for developing windows applications with the following traits:

    • Rich Graphical User Interfaces
    • String and Extensive Data binding.
  2. API(Apllication Programming Interface) to use for accessing the above DLLs and using their powerful capabilities.

How Rendering in Windows Forms Works

Windows Operating Systems have :

  • User32 DLL : a component used to perform management and many of the other functions we associate with the appearance and behavior of standard UI components. These include rendering:

    • Buttons
    • TextBoxes
    • ListBoxes
    • ComboBoxes etc
  • The Win32 API : C language functions that give access to the functionality built in to the windows operating system.

  • GDI DLL : GDI is Graphics Device Interface. Is an abstraction layer and API for graphical objects and allows scaling and rendering on different output devices. There is also a newer version based on C++ called GDI+. GDI and GDI+ are software libraries hence their performance on complex shapes relative to video card rendering can be poorer.

So Windows Forms as well as Microsoft Foundation Classes work just as wrappers around the functionality offered by the User32 and GDI which are sofware components.
This way or rendering has these disadvantages:

  1. Inefficeint - Rendering process is done in the OS software. Hence it doesn't take advantage of the full graphics processing capabilities of the today's built in graphics cards.
  2. Inflexibility - The functionalities and presentation layers are actually built into the operating system. This makes customizations complex. You can only build custom controls with behaviour and look you want.

How WPF Renders

WPF however works in completely different way to the Windows Forms. With WPF rendering is the responsibility of Direct3D.This includes rendering of the seemingly basic controls like textboxes. Hence they also get the full capabilities of the graphics card.

Graphics and Animation

WPF provides built in support for vector-grahic 2D and 3D shapes. This leads to shapes that are more than just visual objects on the screen. These shapes typically can :

  • Be filled with solid colors, gradients, and media like images and video.
  • Support controls' behavior like keyboad and mouse input.

Animation is the changing of a view in small ways quickly over time to give the illusion that an objev is moving or changing. WPF provides built-in support for animations.

Documents and Fonts

The frameworks before WPF had support for only labels, texts and rich text format when it came to support for documents and fonts. First, WPF provides improvements for these controls. Second it introduces two new ways of producing text-based programs:

  • Flow Documents - These allow the their text to flow according to size and shape of the window.
  • Fixed Documents - Text and Formatting are fixed an unchangeable by the end user.

With fonts, WPF adds the support for scalable types like OpenType and ClearType.