Export (0) Print
Expand All

UIElement Class

UIElement is a base class for WPF core level implementations building on Windows Presentation Foundation (WPF) elements and basic presentation characteristics.

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

public class UIElement : Visual, IAnimatable, IInputElement
public class UIElement extends Visual implements IAnimatable, IInputElement
public class UIElement extends Visual implements IAnimatable, IInputElement
<UIElement .../>

UIElement provides a starting point for element layout characteristics, and also exposes virtual methods that derived classes can override, which can influence the layout rendering behavior of the element and its child elements.

Much of the input and focusing behavior for elements in general is also defined in the UIElement class. This includes the events for keyboard, mouse and stylus input, and related status properties. Many of these events are routed events, and many of the input-related events have both a bubbling routing version as well as a tunneling version of the event. These paired events are typically the events of greatest interest to control authors.

UIElement also includes APIs that relate to the WPF event model, including methods that can raise specified routed events that are sourced from an element instance.

In terms of architecture, UIElement can be considered roughly equivalent to a window handle in Win32 programming, or an Element in Dynamic HTML (DHTML) programming. UIElement is a base element at the WPF core level.

A UIElement has the following capabilities that are specifically defined by the UIElement class:

  • Can render as a child element (UIElement derives from Visual, a high level graphics class)

  • Contains logic that is used to size and position possible child elements of a UIElement (when interpreted by a layout system)

  • Can respond to user input (including control of where input is getting sent to via their handling of event routing, or routing of commands)

  • Can raise routed events that travel a route through the logical element tree

  • Supports some aspects of the animation system

FrameworkElement is the WPF framework-level implementation class that builds on UIElement, and adds specific interactions with the WPF framework level. FrameworkElement adds and defines the following capabilities:

  • Additional framework-specific layout characteristics

  • Support for richer metadata reporting on properties

  • Class-specific implementation of certain input base classes and their attached properties or attached events

  • Style support

  • Further animation support

Another related class is ContentElement. The ContentElement class implements many of the same members as does UIElement; the difference between these two classes has to do with their intended place in the overall content model. A UIElement derived class typically defines a relatively rigid content model, meaning that there are restrictions on what elements may be child elements in markup. There might be capacity for taking less restrictive child content in a UIElement, but that capacity is typically centralized in designated content properties. A ContentElement derived class is typically not as restrictive about content, to support scenarios such as flow-format documents.

NoteImportant:

Visibility state affects all input handling by that element. Elements that are not visible do not participate in hit testing and do not receive input events, even if the mouse is over the bounds where the element would be if were visible.

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

Community Additions

ADD
Show:
© 2014 Microsoft