NET and NET Core 8 WPF Hierarchy Pan




















- Slides: 20

. NET and. NET Core 8. WPF Hierarchy Pan Wuming 2017

WPF Class Hierarchy

Unmanaged component • The milcore is an unmanaged component • This is to enable tight integration with Direct. X

Dispatcher. Object • WPF is based on a messaging system implemented by the dispatcher • The dispatcher is a basic message dispatching system, with multiple prioritized queues. • Examples of messages include raw input notifications (mouse moved), framework functions (layout), or user commands (execute this method). • WPF’s threading model was kept in sync with the model of single threaded execution with thread affinity (STA). • Dispatcher. Object is simply an object that’s linked to a dispatcher—in other words, an object that’s bound to the dispatcher’s thread.




Dependency. Object • WPF elements are built on the principle of composition and component reuse. • System driven by properties: • The property system is truly a "dependency" property system in that it tracks dependencies between property expressions and automatically revalidates property values when dependencies change. • Two way binding and change notification • Property expression: free of hard code • Sparse storage of property values • Attached properties: Additional data on child elements




In WPF, properties are typically exposed as common language runtime (CLR) properties. • At a basic level, you could interact with these properties directly and never know that they are implemented as a dependency property.

Visual • Visual is the point of connection between the managed API and the unmanaged milcore • The entire tree of visuals and drawing instructions is cached • WPF allows each component to paint over the previous component's display.

UIElement • Core subsystems: Layout, Input, and Events. • Two phase layout model: Measure and Arrange. • Events routing: previewing input events tunnel and bubbling input events • Command. Bindings

Example: Mouse Events



Framework. Element • Data binding • Styles • A lightweight form of data binding • Bind a set of properties from a shared definition to one or more instances of an element


Control • Templating • Data model (properties) • Interaction model (commands and events) • Display model (templates)