System.Windows Namespace


.NET Framework Class Library for Silverlight
FrameworkElement Class

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)
Syntax

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

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 defined 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 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.

It is not common to derive directly from FrameworkElement because certain expected services for a class that is intended for a UI representation (such as template support) are not fully implemented at that level. 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.

JavaScript API Note

In the JavaScript API for Silverlight, the UIElement object combines the members of UIElement and FrameworkElement.

Inheritance Hierarchy

System..::.Object
  System.Windows..::.DependencyObject
    System.Windows..::.UIElement
      System.Windows..::.FrameworkElement
        System.Windows.Controls..::.Border
        System.Windows.Controls..::.ContentPresenter
        System.Windows.Controls..::.Control
        System.Windows.Controls..::.Image
        System.Windows.Controls..::.ItemsPresenter
        System.Windows.Controls..::.MediaElement
        System.Windows.Controls..::.MultiScaleImage
        System.Windows.Controls..::.Panel
        System.Windows.Controls.Primitives..::.Popup
        System.Windows.Controls..::.TextBlock
        System.Windows.Documents..::.Glyphs
        System.Windows.Shapes..::.Shape
Thread Safety

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

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

See Also

Reference

Other Resources

Tags :


Page view tracker