Manish Pansiniya's Blog

.NET, C#, Javascript, ASP.NET and lots more…:)

Major Classes Used in WPF (Windows Presentation Foundation) – WPF Tutorial #2

leave a comment »

Following classes are the Major base of WPF. Let’s look at them one by one.

System.Threading.DispatcherObject

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.

System.Windows.DependencyObject

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.

System.Windows.UIElement

UIElement defines core subsystems including Layout, Input, and Events.

System.Windows.FrameworkElement

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!!!

Advertisements

Written by Manish

October 9, 2007 at 8:35 am

Posted in .NET 3.0, WPF

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: