共用方式為


WPF Fundamentals: Content Models

The Windows Presentation Foundation (WPF) API model is both very flexible and at times, very rigid. This is particularly apparent in controls and control-like types. A control or control-like type's primary purpose is to display content. Control-like refers to any type that displays content a UI Automation tool might care about, but doesn’t inherit from Control.

That content might be text, another control, or multiple items. The property used to store this content is called a content property.

Content properties are often weakly typed; their content model is too complex to be enforced by the object model.

There are other, non-control types that also have complex usage requirements. For example, a PathGeometry won't work unless its PathFigure elements are added in a particular order. The Style class also has very detailed rules about the Setter objects it contains. The PathGeometry and Style classes have what is called structured properties. The type families described in this section show content and usage models for types with content properties or structured properties.

In This Section