Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

FrameworkElement Class

Provides a WPF framework-level set of properties, events, and methods for Windows Presentation Foundation (WPF) elements. This class represents the provided WPF framework-level implementation built on the WPF core-level APIs defined by UIElement.

Namespace: System.Windows
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[RuntimeNamePropertyAttribute("Name")] 
[StyleTypedPropertyAttribute(Property="FocusVisualStyle", StyleTargetType=typeof(Control))] 
[XmlLangPropertyAttribute("Language")] 
public class FrameworkElement : UIElement, IFrameworkInputElement, IInputElement, ISupportInitialize
/** @attribute RuntimeNamePropertyAttribute("Name") */ 
/** @attribute StyleTypedPropertyAttribute(Property="FocusVisualStyle", StyleTargetType=System.Windows.Controls.Control) */ 
/** @attribute XmlLangPropertyAttribute("Language") */ 
public class FrameworkElement extends UIElement implements IFrameworkInputElement, IInputElement, 
	ISupportInitialize
RuntimeNamePropertyAttribute("Name") 
StyleTypedPropertyAttribute(Property="FocusVisualStyle", StyleTargetType=System.Windows.Controls.Control) 
XmlLangPropertyAttribute("Language") 
public class FrameworkElement extends UIElement implements IFrameworkInputElement, IInputElement, 
	ISupportInitialize
<FrameworkElement .../>

FrameworkElement is the connecting point between WPF framework-level element classes and the WPF core-level set of UIElement presentation services. For more information about these concepts, see WPF Architecture.

FrameworkElement extends UIElement and adds the following capabilities:

  • Layout system definitionFrameworkElement provides specific WPF framework-level implementations for certain methods that were defined as virtual members in UIElement. Most notably, FrameworkElement seals certain WPF core-level layout overrides, and instead provides a WPF framework-level equivalent that derived classes should override instead. For example, FrameworkElement seals ArrangeCore but provides ArrangeOverride. These changes reflect the fact that at the WPF framework-level there is a full layout system in place that can render any FrameworkElement derived class. At the WPF core level, certain members that will structure a general WPF based layout solution are in place, but the actual engine of the layout system is not defined. For more information, see The Layout System.

  • The logical tree: The general WPF programming model is often expressed in terms of being a tree of elements. Support for expressing the tree of elements as a logical tree, and accompanying support for defining that tree in markup is implemented at the FrameworkElement level. Note however that FrameworkElement deliberately does not define a content model, and leaves that responsibility to derived classes. For more information, see Element Tree.

  • Object lifetime events: It is often useful to know when an element is initialized (the constructor is called) or when the element is first loaded into a logical tree. FrameworkElement defines several events related to object lifetime that provide useful hooks for code-behind operations that involve elements, such as adding more child elements. For more information, see Object Lifetime Events.

  • Support for data binding and dynamic resource references: The property-level support for data binding and resources is implemented by the DependencyProperty class and embodied in the property system, but the ability to resolve a member value that is stored as an Expression (the programming construct that underlies both data binding and dynamic resources) is implemented by FrameworkElement. For more information, see Data Binding Overview and Resources Overview.

  • Styles: FrameworkElement defines the Style property. However, FrameworkElement does not yet define support for templates, or support decorators. These features are introduced by control classes such as Control and ContentControl.

  • More animation support: Some animation support was already defined at the WPF core level, but FrameworkElement extends this by implementing BeginStoryboard and related members.

As can be seen from the class hierarchy, many WPF classes derive from FrameworkElement, either directly or through intermediate base classes such as Panel or Control.

If you intend to use FrameworkElement as a base class, you might want to first examine the existing derived classes. FrameworkElement provides support for a number of basic scenarios, but also lacks a number of features that are desirable for an "element" in the sense of a building block that you use to create user interface (UI) in Extensible Application Markup Language (XAML). For instance, a FrameworkElement does not define any true content model; you cannot place a child element within a true FrameworkElement in Extensible Application Markup Language (XAML). In particular, you might want to look at Control and ContentControl.

System.Object
   System.Windows.Threading.DispatcherObject
     System.Windows.DependencyObject
       System.Windows.Media.Visual
         System.Windows.UIElement
          System.Windows.FrameworkElement
             Derived Classes

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft