WPF Simplified Part 10: WPF Framework Class Hierarchy

The WPF framework contains three major components, the PresentationFramework, the PresentationCore, and the milcore (Media Integration Layer Core).

image

While PresentationFramework and PresentationCore form the managed WPF programming model, MSDN says this about the milcore,

Milcore is written in unmanaged code in order to enable tight integration with DirectX. All display in WPF is done through the DirectX engine, allowing for efficient hardware and software rendering. WPF also required fine control over memory and execution. The composition engine in milcore is extremely performance sensitive, and required giving up many advantages of the CLR to gain performance.

The WPF framework contains many classes and its useful to get an overall view of the class hierarchy. The diagrams below show some of the major class in the framework (not all classes are included) in the WPF class hierarchy.

image

The FrameworkElement contains most of the UI controls that we usually work with, and is expanded below,

image

Some notes about the class hierarchy,

1. All classes in the WPF framework derive from System.Object.

2. Deriving from System.Threading.DispatcherObject gives us a CLR object that has single thread affinity (STA) behavior. Since all the UI controls derive from DispatcherObject, all WPF UI controls can be accessed only on the thread that created it, and are thus inherently thread-unsafe. Some of the methods are of the class are,

    public Dispatcher Dispatcher { get; }
    public bool CheckAccess();
    public void VerifyAccess();
 

3. System.Windows.Dependency is the base class that supports dependency and attached properties. Some of the methods are of the class are,

    public void SetValue(DependencyProperty dp, object value);
    public object GetValue(DependencyProperty dp);
    public void ClearValue(DependencyProperty dp);
 

4. System.Windows.Media.Visual is the entry point to the WPF composition system. This is the base class for all objects that have their own visual representation. Some of the methods are of the class are,

    protected DependencyObject VisualParent { get; }
    protected void AddVisualChild(Visual child);
    protected void RemoveVisualChild(Visual child);
 

5. System.Windows.UIElement adds support for core features like, Events, Input, Layout, and CommandBindings. Some of the methods are of the class are,

    public event MouseButtonEventHandler PreviewMouseLeftButtonDown;
    public event MouseButtonEventHandler MouseLeftButtonDown;
    public static readonly DependencyProperty IsEnabledProperty;
    public bool IsMouseOver { get; }
 

6. System.Windows.FrameworkElement extends the layout features of UIElement and adds support for features like, styles, data binding, resources, data templates, tooltips, and animation. Some of the methods are of the class are,

    public double MinHeight { get; set; }
    public Style Style { get; set; }
    public ResourceDictionary Resources { get; set; }
    public object FindResource(object resourceKey);
    public object ToolTip { get; set; }
    public void BeginStoryboard(Storyboard storyboard);
 

7. System.Windows.Controls.Control adds support for templating and is the base class for the familiar UI controls like Button, Grid, and TextBox. Some of the methods are of the class are,

    public ControlTemplate Template { get; set; }
    public Brush Background { get; set; }
    public FontFamily FontFamily { get; set; }
Digg This
Advertisements

About soumya chattopadhyay
I live and work in Seattle, WA. I work with Microsoft technologies, and I'm especially interested in C#.

5 Responses to WPF Simplified Part 10: WPF Framework Class Hierarchy

  1. Pingback: WPF Simplified Series « I.Net

  2. Brian Reed says:

    Where did you get the class hierarchy images? I would love to get a poster size shot of them.

  3. Mr. D says:

    Reblogged this on D Says and commented:
    WPF Simplified Part 10: WPF Framework Class Hierarchy

  4. Pingback: WPF Logical vs Visual Tree | gridwizard

  5. gridwizard says:

    Concise explanation WPF Logical Tree vs Visual Tree http://tinyurl.com/kqmrxro

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: