WPF

WPF Examples

WPF

WPF Projects

WPF Project

adplus-dvertising
Some Important WPF Classes and Namespaces
Previous Home Next

Before working with WPF you need to know some common classes and interfaces and their uses. So in this chapter you will get a clear understanding of different classes and interfaces and there uses.

Before knowing the classes and namespaces you need to know, what are the base assemblies that provide different classes ad interfaces for a WPF application. WPF has three base assemblies. These are as below,

  1. WindowsBase.dll: This assembly defines the core types that constitute the infrastructure WPF API.
  2. PresentationCore.dll: As the name specifies this assembly specifies different types for WPF GUI layer.
  3. PresentationFoundation.dll: It defines the WPF control types, animation, multimedia and data binding support. It also specifies some other functionality.
  4. The above three namespaces are managed namespaces. Besides these three namespaces WPF also uses an unmanaged library, i.e. milcore.dll. This library is responsible to work with DirectX layer. It acts as a bridge between the managed WPF assemblies and the DirectX layer.
Some WPF Classes:

All these three assemblies provides a number of new namespaces and hundreds of new .NET types(classes, interfaces, structures, enumerations and delegates) to work with WPF. The following class diagram and the class’s functionality.

  • Dispatcher Object: It is an abstract base class for classes that are bound to one thread. Classes that are derived from DispatcherObject have an associated Dispatcher object that can be used to switch the threads.
  • Application: In every WPF application, one instance of Application class is created. This class implements a singleton pattern for access to the window of application, resources and properties. See the below image.
  • Dependency Object: It is the base class for all the classes that supports Dependency property.
  • Visual: It is the base class for all the visual elements of WPF. This class includes features for transformation.
  • UIElement: It is the abstract base class for all WPF elements that need basic presentation feature. This class provides evens such as mouse move, drag and drop, click, etc.
  • Framework Element: It is derived from base class UIElements and implements the default behaviour of the methods defined by the base class.
  • Shape: Shape is the base class for all the shape elements such as, line, rectangle, ellipse, polygon.
  • Control: It is derived from FrameworkElement and is the base class for all the user-interactive elements.
  • Panel: As the name suggest it is the abstract base class for all the panels and is derived from FrameworkElement. Panel class has a Children property for all the UI-Element that is inside a panel and defines methods for arranging the child controls. Panel defines different classes to define the behaviour of child controls such as, WrapPanel, StackPanel, Grid and Canvas.
  • Content Control: It is the base class for all the controls that have a single content such as, Buttons, Labels, CheckBox, RadioButton, etc.

You can also find the class hierarchy of your application using Object Browser in VS 2008. To view Object Browser go to view menu and select Object Browser. Object Browser also contains all the namespaces and its classes. See the below image for WPF class hierarchy. It is the class hierarchy of a simple WPF application that we have created earlier. Using Object Browser you can find all the methods, properties and events of a particular class by selecting that class.

Some WPF Namespaces:
  • System.Windows: It is the core namespace of WPF. You will find all the base classes such as, Application, DependencyObject , DependencyProperty and FrameworkElement here.
  • System.Windows.Controls: This namespaces contains all the controls of WPF. You will also find classes to work with complex controls such as PopUp, ScrollBar, StatusBar, TabPanel, etc. as well as all the basic controls.
  • System.Windows.Data: This namespace is used by WPF for Data Binding.
  • System.Windows.Input: This namespace provides several classes for command handling, keyboard input, etc.
  • System.Windows.Markup: This namespace helper classes for XAML markup code.
  • System.Windows.Media: This namespace is responsible to work with images, audio, and multimedia.
  • System.Windows.Shapes: This namespace provides core classes for UI such as Line, Rectangle, Ellipse, etc.
  • System. Windows. Threading: This namespace provides classes to work with multiple threads.
  • System.Windows.Navigation: This namespace provides classes for navigation between WPF pages particularly when working with Web Applications.
Previous Home Next
WPF Examples

WPF

WPF

WPF

WPF

WPF

WPF

WPF

WPF