Printer Friendly Version      Send     
Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
Silverlight
Other versions are also available for the following:
.NET Framework Class Library for Silverlight
FrameworkElement Class
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Provides a framework of common APIs for objects that participate in Silverlight layout. Also defines APIs related to data binding, object tree and object lifetime feature areas in Silverlight.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)

Visual Basic (Declaration)
Public MustInherit Class FrameworkElement _
    Inherits UIElement
Visual Basic (Usage)
Dim instance As FrameworkElement
C#
public abstract class FrameworkElement : UIElement
Visual C++
public ref class FrameworkElement abstract : public UIElement
JScript
public abstract class FrameworkElement extends UIElement

FrameworkElement extends UIElement and adds the following capabilities:

  • Layout: Similar to WPF, Silverlight implements its layout system to recognize objects that derive from FrameworkElement and reads various properties that are defined at that level, such as MinWidth, and provides extensible methods for specialized layout behavior that panels and controls can override in their class implementations.

  • Object lifetime events: It is often useful to know when the object is first loaded ("loaded" is define as when an object becomes attached to an object tree that connects to the Silverlight RootVisual). FrameworkElement defines events related to object lifetime that provide useful hooks for code-behind operations, such as adding child objects to a collection or setting properties on child objects just prior to use, with assurance that the necessary objects in the object tree have been instantiated from markup.

  • Support for data binding: The property-level support for data binding and resources is implemented by the DependencyProperty class and embodied in the property system, and any DependencyObject can have a DependencyProperty, but the ability to resolve a member value that is declared as a binding and uses a data context is implemented by FrameworkElement.

Many common Silverlight classes derive from FrameworkElement, either directly or through intermediate base classes such as Panel or Control.

Neither UIElement nor FrameworkElement expose a public constructor, and it is not common to derive from either of these classes directly. More commonly used base classes for derived custom classes are:

FrameworkElement provides support for a number of basic scenarios, but also lacks a number of features that are desirable for a "UI element" in the sense of a building block that you use to create UI in XAML. Many of these features are instead implemented on Control, or other immediate subclasses of FrameworkElement.

Unmanaged Programming Model Note

In the Silverlight unmanaged programming model, the UIElement object combines the members of UIElement and FrameworkElement.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker