Major Classes Used in WPF (Windows Presentation Foundation) – WPF Tutorial #2
Following classes are the Major base of WPF. Let’s look at them one by one.
Almost each class in the WPF is derived from DispatcherObject directly or indirectly. This class is used for handling concurrency and threading. It’s also responsible for events management. If you know win32 then you are aware of message pump. The same work is done by dispacherobject here.
During the design phase of WPF, the goal was to move to a single thread of execution (STA), but a non-thread “affinitized” model (Affinity : the force attracting atoms to each other and binding them together in a molecule). The reason of STA is interoperability. We are not going into the details of this. And second one Given that you have objects with STA threading, you need a way to communicate between threads, and validate that you are on the correct thread. Here in lies the role of the dispatcher.
One of the primary architectural philosophies used in building WPF was a preference for properties over methods or events. WPF introduces a new type of property called a dependency property, used throughout the platform to enable styling, automatic data binding, animation, and more. For example, if there is window object and you are applying some styles to window object, you need same styling applying to all child object. In that case, in normal application, you need to implement the methods which willl set all the child’s proprety to required values. But with the above DependacyObject, this can be minimized to almost 0. You can set the dependency and notification on the property. Please look at this article for more information regarding DependencyObject and Properties. http://www.codeproject.com/books/wpf_unleashed.asp. Also there are attached properties used for the similar purpose.System.Windows.Media.Visual
When system is defined, the next step is to draw pixels on the screen. This Visual class is the point of connection between these two subsystems, the managed API and the unmanaged milcore.
UIElement defines core subsystems including Layout, Input, and Events.
The primary features provided by FrameworkElement relate to application layout. FrameworkElement builds on the layout introduced by UIElement (see the previous section) and makes it easier for layout authors to have a consistent set of layout semantics. Effectively, it allows the programmer or designer to override the automatic layout functionality introduced by UIElement by specifying alignment and layout properties for controls. These then use FrameworkElement under the hood. Two critical elements that FrameworkElement introduces to the WPF platform are data binding and styles.
Pretty Hard huh!!!