Ugrás a tartalomhoz

.NET Programming Technologies

Gergely Kovásznai, Csaba Biró

Eszterházy Károly College

WPF class hierarchy

WPF class hierarchy

The WPF namespaces are located in the System.Windows namespace (eg. System.Windows, System.Windows.Controls and the System.Windows.Media). An exception is System.Windows.Forms lower-namespace,which still includes the traditional GDI/GDI+ based controls.

The most important WPF subsystems, their functionality and interactions between them will be displayed in the following lines.

II.2. WPF classes


All of the classes of the WPF from the System.Object. The major components of WPF: (picture II.3) The red marked parts PresentationFramework, PresentationCore and milcore including the main WPF code details. Milcore the only one is unmanaged code written component. The main reason is to permit of close integration with DirectX. In the case of WPF displaying happens through the DirectX motor/engine. It enables efficient software and hardware rendering. The milcore engine has extremely sharpened performance, that is why it losts a number of CLR (Common Language Runtime) advantage.


Most of the WPF objects are from the DispatcherObject.  The WPF applications use the well known single-stranded (single-thread affinity, STA) model. It means that one thread controls and monitors the entire user interface. Some objects can not be achieved safely connected directly to other fibers. It means that only the owner thread access an object created with affinity.


Its primary task is tocompute the property’s value and notify about the changes of properties to the system.

Some methods:

     public void SetValue(DependencyProperty dp, object value);

     public object GetValue(DependencyProperty dp);

     public void ClearValue(DependencyProperty dp);


It is the basic of the visualizable elements on the windows. The Visual class provides a link between the managed WPF libraries and the milcore.dll. Actually, the Visual class is a basic abstraction, from which all the FrameworkElement objects come from, whose primary function is to support the rendering. The UI controls, such as Button, Slider, etc… all from the Visual class.

Some methods:

    protected DependencyObject VisualParent { get; }

    protected void AddVisualChild(Visual child);

    protected void RemoveVisualChild(Visual child);


The UIElement contains the main elements of WPF (e.g StackPanel, Grid, etc..), and supports input, focus and manage events.

Some methods:

    public event MouseButtonEventHandler PreviewMouseLeftButtonDown;

    public event MouseButtonEventHandler MouseLeftButtonDown;

 fSystem.O   public static readonly DependencyProperty IsEnabledProperty;

    public bool IsMouseOver { get; }


This is the last stage of the inheritance chain. While in the UIElement class you can define an array, its layout properties can be specified here, such as HorizontalAlignment, Width, Margin, etc.

Some methods:

    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);


The basic shapes such as Rectangle, Poligon, Line derived from this class.


The basic controls are from the Control class TextBox, Button, ListBox, etc. It also provides options for the additional setup of the controllers. (e.g Font, Background, etc.)

Some methods:

public ControlTemplate Template { get; set; }

public Brush Background { get; set; }

public FontFamily FontFamily { get; set; }


The System.Windows.Controls.ContentControl class allows to give rich content to the controllers.

II.2 Example ContentControl



    <Ellipse Height="40" Width="40" Fill="Blue"/>

    <TextBlock TextAlignment="Center">WPF</TextBlock>