Skip to Main Content
Programming WPF, 2nd Edition
book

Programming WPF, 2nd Edition

by Chris Sells, Ian Griffiths
August 2007
Intermediate to advanced content levelIntermediate to advanced
864 pages
25h 52m
English
O'Reilly Media, Inc.
Content preview from Programming WPF, 2nd Edition

ContentElement

System.Object
    System.Windows.Threading.DispatcherObject
        System.Windows.DependencyObject
            System.Windows.ContentElement

Text has distinctive layout requirements that are unlike those of the rest of the user interface. Consequently, there is a separate part of the class hierarchy for managing textual content. ContentElement is at the root of this hierarchy, and it derives directly from DependencyObject, not Visual.

ContentElement is the base class of FrameworkContentElement, which is the base class of all the types in WPF's text object model. The split between ContentElement and FrameworkContentElement exists for the same reason as the split between UIElement and FrameworkElement: ContentElement is part of WPF's core API, whereas FrameworkContentElement is part of WPF's framework API. The separation of responsibilities is similar—ContentElement provides basic event handling and animation support, and FrameworkContentElement adds data binding and layout.

As with UIElement, you would derive directly from ContentElement only if you were writing your own UI framework on top of WPF's core services. Most WPF applications will only use types derived from FrameworkContentElement.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming C#, 4th Edition

Programming C#, 4th Edition

Jesse Liberty
Programming C# 10

Programming C# 10

Ian Griffiths

Publisher Resources

ISBN: 9780596510374Supplemental ContentErrata Page