Skip to main content
.NET Framework Class Library
Rectangle Class

Draws a rectangle.

Inheritance Hierarchy
SystemObject
   System.Windows.ThreadingDispatcherObject
     System.WindowsDependencyObject
       System.Windows.MediaVisual
         System.WindowsUIElement
           System.WindowsFrameworkElement
             System.Windows.ShapesShape
              System.Windows.ShapesRectangle

Namespace:   System.Windows.Shapes
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Syntax
Public NotInheritable Class Rectangle _
	Inherits [%$TOPIC/ms615650_en-us_VS_110_2_0_0_0_0%]
public sealed class Rectangle : [%$TOPIC/ms615650_en-us_VS_110_2_0_1_0_0%]
public ref class Rectangle sealed : public [%$TOPIC/ms615650_en-us_VS_110_2_0_2_0_0%]
[<[%$TOPIC/ms615650_en-us_VS_110_2_0_3_0_0%]>]
type Rectangle =  
    class 
        inherit [%$TOPIC/ms615650_en-us_VS_110_2_0_3_0_1%] 
    end
<Rectangle .../>

The Rectangle type exposes the following members.

Constructors
  NameDescription
Public method RectangleInitializes a new instance of the Rectangle class.
Top
Properties
  NameDescription
Public property ActualHeightGets the rendered height of this element. (Inherited from FrameworkElement.)
Public property ActualWidthGets the rendered width of this element. (Inherited from FrameworkElement.)
Public property AllowDropGets or sets a value indicating whether this element can be used as the target of a drag-and-drop operation. This is a dependency property. (Inherited from UIElement.)
Public property AreAnyTouchesCapturedGets a value that indicates whether at least one touch is captured to this element. (Inherited from UIElement.)
Public property AreAnyTouchesCapturedWithinGets a value that indicates whether at least one touch is captured to this element or to any child elements in its visual tree. (Inherited from UIElement.)
Public property AreAnyTouchesDirectlyOverGets a value that indicates whether at least one touch is pressed over this element. (Inherited from UIElement.)
Public property AreAnyTouchesOverGets a value that indicates whether at least one touch is pressed over this element or any child elements in its visual tree. (Inherited from UIElement.)
Public property BindingGroupGets or sets the BindingGroup that is used for the element. (Inherited from FrameworkElement.)
Public property BitmapEffectObsolete. Gets or sets a bitmap effect that applies directly to the rendered content for this element. This is a dependency property. (Inherited from UIElement.)
Public property BitmapEffectInputObsolete. Gets or sets an input source for the bitmap effect that applies directly to the rendered content for this element. This is a dependency property. (Inherited from UIElement.)
Public property CacheModeGets or sets a cached representation of the UIElement. (Inherited from UIElement.)
Public property ClipGets or sets the geometry used to define the outline of the contents of an element. This is a dependency property. (Inherited from UIElement.)
Public property ClipToBoundsGets or sets a value indicating whether to clip the content of this element (or content coming from the child elements of this element) to fit into the size of the containing element. This is a dependency property. (Inherited from UIElement.)
Public property CommandBindingsGets a collection of CommandBinding objects associated with this element. A CommandBinding enables command handling for this element, and declares the linkage between a command, its events, and the handlers attached by this element. (Inherited from UIElement.)
Public property ContextMenu Gets or sets the context menu element that should appear whenever the context menu is requested through user interface (UI) from within this element. (Inherited from FrameworkElement.)
Public property CursorGets or sets the cursor that displays when the mouse pointer is over this element. (Inherited from FrameworkElement.)
Public property DataContext Gets or sets the data context for an element when it participates in data binding. (Inherited from FrameworkElement.)
Protected property DefaultStyleKeyGets or sets the key to use to reference the style for this control, when theme styles are used or defined. (Inherited from FrameworkElement.)
Public property DependencyObjectTypeGets the DependencyObjectType that wraps the CLR type of this instance.  (Inherited from DependencyObject.)
Public property DesiredSizeGets the size that this element computed during the measure pass of the layout process. (Inherited from UIElement.)
Public property DispatcherGets the Dispatcher this DispatcherObject is associated with. (Inherited from DispatcherObject.)
Public property EffectGets or sets the bitmap effect to apply to the UIElement. This is a dependency property. (Inherited from UIElement.)
Public property FillGets or sets the Brush that specifies how the shape's interior is painted. (Inherited from Shape.)
Public property FlowDirectionGets or sets the direction that text and other user interface (UI) elements flow within any parent element that controls their layout. (Inherited from FrameworkElement.)
Public property FocusableGets or sets a value that indicates whether the element can receive focus. This is a dependency property. (Inherited from UIElement.)
Public property FocusVisualStyleGets or sets a property that enables customization of appearance, effects, or other style characteristics that will apply to this element when it captures keyboard focus. (Inherited from FrameworkElement.)
Public property ForceCursorGets or sets a value that indicates whether this FrameworkElement should force the user interface (UI) to render the cursor as declared by the Cursor property. (Inherited from FrameworkElement.)
Public property GeometryTransformGets the Transform that is applied to this Rectangle. (Overrides ShapeGeometryTransform.)
Public property HasAnimatedPropertiesGets a value indicating whether this element has any animated properties. (Inherited from UIElement.)
Protected property HasEffectiveKeyboardFocusGets a value that indicates whether the UIElement has focus. (Inherited from UIElement.)
Public property Height Gets or sets the suggested height of the element. (Inherited from FrameworkElement.)
Public property HorizontalAlignmentGets or sets the horizontal alignment characteristics applied to this element when it is composed within a parent element, such as a panel or items control. (Inherited from FrameworkElement.)
Protected property InheritanceBehaviorGets or sets the scope limits for property value inheritance, resource key lookup, and RelativeSource FindAncestor lookup. (Inherited from FrameworkElement.)
Public property InputBindings Gets the collection of input bindings associated with this element. (Inherited from UIElement.)
Public property InputScopeGets or sets the context for input used by this FrameworkElement. (Inherited from FrameworkElement.)
Public property IsArrangeValidGets a value indicating whether the computed size and position of child elements in this element's layout are valid. (Inherited from UIElement.)
Public property IsEnabledGets or sets a value indicating whether this element is enabled in the user interface (UI). This is a dependency property. (Inherited from UIElement.)
Public property IsFocusedGets a value that determines whether this element has logical focus. This is a dependency property. (Inherited from UIElement.)
Public property IsHitTestVisibleGets or sets a value that declares whether this element can possibly be returned as a hit test result from some portion of its rendered content. This is a dependency property. (Inherited from UIElement.)
Public property IsInitializedGets a value that indicates whether this element has been initialized, either during processing by a XAML processor, or by explicitly having its EndInit method called. (Inherited from FrameworkElement.)
Public property IsInputMethodEnabledGets a value indicating whether an input method system, such as an Input Method Editor (IME), is enabled for processing the input to this element. (Inherited from UIElement.)
Public property IsKeyboardFocusedGets a value indicating whether this element has keyboard focus. This is a dependency property. (Inherited from UIElement.)
Public property IsKeyboardFocusWithinGets a value indicating whether keyboard focus is anywhere within the element or its visual tree child elements. This is a dependency property. (Inherited from UIElement.)
Public property IsLoadedGets a value that indicates whether this element has been loaded for presentation. (Inherited from FrameworkElement.)
Public property IsManipulationEnabledGets or sets a value that indicates whether manipulation events are enabled on this UIElement. (Inherited from UIElement.)
Public property IsMeasureValidGets a value indicating whether the current size returned by layout measure is valid. (Inherited from UIElement.)
Public property IsMouseCapturedGets a value indicating whether the mouse is captured to this element. This is a dependency property. (Inherited from UIElement.)
Public property IsMouseCaptureWithinGets a value that determines whether mouse capture is held by this element or by child elements in its visual tree. This is a dependency property. (Inherited from UIElement.)
Public property IsMouseDirectlyOverGets a value that indicates whether the position of the mouse pointer corresponds to hit test results, which take element compositing into account. This is a dependency property. (Inherited from UIElement.)
Public property IsMouseOverGets a value indicating whether the mouse pointer is located over this element (including child elements in the visual tree). This is a dependency property. (Inherited from UIElement.)
Public property IsSealedGets a value that indicates whether this instance is currently sealed (read-only). (Inherited from DependencyObject.)
Public property IsStylusCapturedGets a value indicating whether the stylus is captured by this element. This is a dependency property. (Inherited from UIElement.)
Public property IsStylusCaptureWithinGets a value that determines whether stylus capture is held by this element, or an element within the element bounds and its visual tree. This is a dependency property. (Inherited from UIElement.)
Public property IsStylusDirectlyOverGets a value that indicates whether the stylus position corresponds to hit test results, which take element compositing into account. This is a dependency property. (Inherited from UIElement.)
Public property IsStylusOver Gets a value indicating whether the stylus cursor is located over this element (including visual child elements). This is a dependency property. (Inherited from UIElement.)
Public property IsVisibleGets a value indicating whether this element is visible in the user interface (UI). This is a dependency property. (Inherited from UIElement.)
Public property LanguageGets or sets localization/globalization language information that applies to an element. (Inherited from FrameworkElement.)
Public property LayoutTransform Gets or sets a graphics transformation that should apply to this element when layout is performed. (Inherited from FrameworkElement.)
Protected property LogicalChildren Gets an enumerator for logical child elements of this element. (Inherited from FrameworkElement.)
Public property MarginGets or sets the outer margin of an element. (Inherited from FrameworkElement.)
Public property MaxHeightGets or sets the maximum height constraint of the element. (Inherited from FrameworkElement.)
Public property MaxWidthGets or sets the maximum width constraint of the element. (Inherited from FrameworkElement.)
Public property MinHeightGets or sets the minimum height constraint of the element. (Inherited from FrameworkElement.)
Public property MinWidth Gets or sets the minimum width constraint of the element. (Inherited from FrameworkElement.)
Public property NameGets or sets the identifying name of the element. The name provides a reference so that code-behind, such as event handler code, can refer to a markup element after it is constructed during processing by a XAML processor. (Inherited from FrameworkElement.)
Public property OpacityGets or sets the opacity factor applied to the entire UIElement when it is rendered in the user interface (UI). This is a dependency property. (Inherited from UIElement.)
Public property OpacityMaskGets or sets an opacity mask, as a Brush implementation that is applied to any alpha-channel masking for the rendered content of this element. This is a dependency property. (Inherited from UIElement.)
Public property OverridesDefaultStyleGets or sets a value that indicates whether this element incorporates style properties from theme styles. (Inherited from FrameworkElement.)
Public property ParentGets the logical parent element of this element. (Inherited from FrameworkElement.)
Public property PersistIdObsolete. Gets a value that uniquely identifies this element. (Inherited from UIElement.)
Public property RadiusXGets or sets the x-axis radius of the ellipse that is used to round the corners of the rectangle.
Public property RadiusYGets or sets the y-axis radius of the ellipse that is used to round the corners of the rectangle.
Public property RenderedGeometryGets a Geometry object that represents the final rendered shape. (Overrides ShapeRenderedGeometry.)
Public property RenderSizeGets (or sets, but see Remarks) the final render size of this element. (Inherited from UIElement.)
Public property RenderTransformGets or sets transform information that affects the rendering position of this element. This is a dependency property. (Inherited from UIElement.)
Public property RenderTransformOriginGets or sets the center point of any possible render transform declared by RenderTransform, relative to the bounds of the element. This is a dependency property. (Inherited from UIElement.)
Public property Resources Gets or sets the locally-defined resource dictionary. (Inherited from FrameworkElement.)
Public property SnapsToDevicePixelsGets or sets a value that determines whether rendering for this element should use device-specific pixel settings during rendering. This is a dependency property. (Inherited from UIElement.)
Public property StretchGets or sets a Stretch enumeration value that describes how the shape fills its allocated space. (Inherited from Shape.)
Public property StrokeGets or sets the Brush that specifies how the Shape outline is painted. (Inherited from Shape.)
Public property StrokeDashArrayGets or sets a collection of Double values that indicate the pattern of dashes and gaps that is used to outline shapes. (Inherited from Shape.)
Public property StrokeDashCapGets or sets a PenLineCap enumeration value that specifies how the ends of a dash are drawn. (Inherited from Shape.)
Public property StrokeDashOffsetGets or sets a Double that specifies the distance within the dash pattern where a dash begins. (Inherited from Shape.)
Public property StrokeEndLineCapGets or sets a PenLineCap enumeration value that describes the Shape at the end of a line. (Inherited from Shape.)
Public property StrokeLineJoinGets or sets a PenLineJoin enumeration value that specifies the type of join that is used at the vertices of a Shape. (Inherited from Shape.)
Public property StrokeMiterLimitGets or sets a limit on the ratio of the miter length to half the StrokeThickness of a Shape element. (Inherited from Shape.)
Public property StrokeStartLineCapGets or sets a PenLineCap enumeration value that describes the Shape at the start of a Stroke. (Inherited from Shape.)
Public property StrokeThicknessGets or sets the width of the Shape outline. (Inherited from Shape.)
Public property StyleGets or sets the style used by this element when it is rendered. (Inherited from FrameworkElement.)
Public property TagGets or sets an arbitrary object value that can be used to store custom information about this element. (Inherited from FrameworkElement.)
Public property TemplatedParentGets a reference to the template parent of this element. This property is not relevant if the element was not created through a template. (Inherited from FrameworkElement.)
Public property ToolTip Gets or sets the tool-tip object that is displayed for this element in the user interface (UI). (Inherited from FrameworkElement.)
Public property TouchesCapturedGets all touch devices that are captured to this element. (Inherited from UIElement.)
Public property TouchesCapturedWithinGets all touch devices that are captured to this element or any child elements in its visual tree. (Inherited from UIElement.)
Public property TouchesDirectlyOverGets all touch devices that are over this element. (Inherited from UIElement.)
Public property TouchesOverGets all touch devices that are over this element or any child elements in its visual tree. (Inherited from UIElement.)
Public property TriggersGets the collection of triggers established directly on this element, or in child elements. (Inherited from FrameworkElement.)
Public property UidGets or sets the unique identifier (for localization) for this element. This is a dependency property. (Inherited from UIElement.)
Public property UseLayoutRoundingGets or sets a value that indicates whether layout rounding should be applied to this element's size and position during layout. (Inherited from FrameworkElement.)
Public property VerticalAlignmentGets or sets the vertical alignment characteristics applied to this element when it is composed within a parent element such as a panel or items control. (Inherited from FrameworkElement.)
Public property VisibilityGets or sets the user interface (UI) visibility of this element. This is a dependency property. (Inherited from UIElement.)
Protected property VisualBitmapEffectObsolete. Gets or sets the BitmapEffect value for the Visual. (Inherited from Visual.)
Protected property VisualBitmapEffectInputObsolete. Gets or sets the BitmapEffectInput value for the Visual. (Inherited from Visual.)
Protected property VisualBitmapScalingModeGets or sets the BitmapScalingMode for the Visual. (Inherited from Visual.)
Protected property VisualCacheModeGets or sets a cached representation of the Visual. (Inherited from Visual.)
Protected property VisualClearTypeHintGets or sets the ClearTypeHint that determines how ClearType is rendered in the Visual. (Inherited from Visual.)
Protected property VisualClipGets or sets the clip region of the Visual as a Geometry value. (Inherited from Visual.)
Protected property VisualEdgeModeGets or sets the edge mode of the Visual as an EdgeMode value. (Inherited from Visual.)
Protected property VisualEffectGets or sets the bitmap effect to apply to the Visual. (Inherited from Visual.)
Protected property VisualOffsetGets or sets the offset value of the visual object. (Inherited from Visual.)
Protected property VisualOpacityGets or sets the opacity of the Visual. (Inherited from Visual.)
Protected property VisualOpacityMaskGets or sets the Brush value that represents the opacity mask of the Visual. (Inherited from Visual.)
Protected property VisualScrollableAreaClipGets or sets a clipped scrollable area for the Visual. (Inherited from Visual.)
Protected property VisualTextHintingModeGets or sets the TextHintingMode of the Visual. (Inherited from Visual.)
Protected property VisualTextRenderingModeGets or sets the TextRenderingMode of the Visual. (Inherited from Visual.)
Protected property VisualTransformGets or sets the Transform value for the Visual. (Inherited from Visual.)
Protected property VisualXSnappingGuidelinesGets or sets the x-coordinate (vertical) guideline collection. (Inherited from Visual.)
Protected property VisualYSnappingGuidelinesGets or sets the y-coordinate (horizontal) guideline collection. (Inherited from Visual.)
Public property Width Gets or sets the width of the element. (Inherited from FrameworkElement.)
Top
Methods
  NameDescription
Public method AddHandler(RoutedEvent, Delegate)Adds a routed event handler for a specified routed event, adding the handler to the handler collection on the current element. (Inherited from UIElement.)
Public method AddHandler(RoutedEvent, Delegate, Boolean)Adds a routed event handler for a specified routed event, adding the handler to the handler collection on the current element. Specify handledEventsToo as true to have the provided handler be invoked for routed event that had already been marked as handled by another element along the event route. (Inherited from UIElement.)
Protected method AddLogicalChildAdds the provided object to the logical tree of this element. (Inherited from FrameworkElement.)
Public method AddToEventRouteAdds handlers to the specified EventRoute for the current UIElement event handler collection. (Inherited from UIElement.)
Public method ApplyAnimationClock(DependencyProperty, AnimationClock)Applies an animation to a specified dependency property on this element. Any existing animations are stopped and replaced with the new animation. (Inherited from UIElement.)
Public method ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior)Applies an animation to a specified dependency property on this element, with the ability to specify what happens if the property already has a running animation. (Inherited from UIElement.)
Public method ApplyTemplateBuilds the current template's visual tree if necessary, and returns a value that indicates whether the visual tree was rebuilt by this call. (Inherited from FrameworkElement.)
Public method ArrangePositions child elements and determines a size for a UIElement. Parent elements call this method from their ArrangeCore implementation (or a WPF framework-level equivalent) to form a recursive layout update. This method constitutes the second pass of a layout update. (Inherited from UIElement.)
Public method BeginAnimation(DependencyProperty, AnimationTimeline)Starts an animation for a specified animated property on this element. (Inherited from UIElement.)
Public method BeginAnimation(DependencyProperty, AnimationTimeline, HandoffBehavior)Starts a specific animation for a specified animated property on this element, with the option of specifying what happens if the property already has a running animation. (Inherited from UIElement.)
Public method BeginInitStarts the initialization process for this element. (Inherited from FrameworkElement.)
Public method BeginStoryboard(Storyboard)Begins the sequence of actions that are contained in the provided storyboard. (Inherited from FrameworkElement.)
Public method BeginStoryboard(Storyboard, HandoffBehavior)Begins the sequence of actions contained in the provided storyboard, with options specified for what should happen if the property is already animated. (Inherited from FrameworkElement.)
Public method BeginStoryboard(Storyboard, HandoffBehavior, Boolean) Begins the sequence of actions contained in the provided storyboard, with specified state for control of the animation after it is started. (Inherited from FrameworkElement.)
Public method BringIntoViewAttempts to bring this element into view, within any scrollable regions it is contained within. (Inherited from FrameworkElement.)
Public method BringIntoView(Rect)Attempts to bring the provided region size of this element into view, within any scrollable regions it is contained within. (Inherited from FrameworkElement.)
Public method CaptureMouseAttempts to force capture of the mouse to this element. (Inherited from UIElement.)
Public method CaptureStylus Attempts to force capture of the stylus to this element. (Inherited from UIElement.)
Public method CaptureTouchAttempts to force capture of a touch to this element. (Inherited from UIElement.)
Public method CheckAccessDetermines whether the calling thread has access to this DispatcherObject. (Inherited from DispatcherObject.)
Public method ClearValue(DependencyProperty)Clears the local value of a property. The property to be cleared is specified by a DependencyProperty identifier. (Inherited from DependencyObject.)
Public method ClearValue(DependencyPropertyKey)Clears the local value of a read-only property. The property to be cleared is specified by a DependencyPropertyKey. (Inherited from DependencyObject.)
Public method CoerceValueCoerces the value of the specified dependency property. This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject. (Inherited from DependencyObject.)
Public method EndInitIndicates that the initialization process for the element is complete. (Inherited from FrameworkElement.)
Public method EqualsDetermines whether a provided DependencyObject is equivalent to the current DependencyObject. (Inherited from DependencyObject.)
Public method FindCommonVisualAncestorReturns the common ancestor of two visual objects. (Inherited from Visual.)
Public method FindNameFinds an element that has the provided identifier name. (Inherited from FrameworkElement.)
Public method FindResourceSearches for a resource with the specified key, and throws an exception if the requested resource is not found. (Inherited from FrameworkElement.)
Public method FocusAttempts to set focus to this element. (Inherited from UIElement.)
Public method GetAnimationBaseValueReturns the base property value for the specified property on this element, disregarding any possible animated value from a running or stopped animation. (Inherited from UIElement.)
Public method GetBindingExpressionReturns the BindingExpression that represents the binding on the specified property. (Inherited from FrameworkElement.)
Public method GetHashCodeGets a hash code for this DependencyObject. (Inherited from DependencyObject.)
Public method GetLocalValueEnumeratorCreates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject. (Inherited from DependencyObject.)
Protected method GetTemplateChildReturns the named element in the visual tree of an instantiated ControlTemplate. (Inherited from FrameworkElement.)
Public method GetTypeGets the Type of the current instance. (Inherited from Object.)
Protected method GetUIParentCoreReturns an alternative logical parent for this element if there is no visual parent. (Inherited from FrameworkElement.)
Public method GetValueReturns the current effective value of a dependency property on this instance of a DependencyObject. (Inherited from DependencyObject.)
Public method InputHitTest Returns the input element within the current element that is at the specified coordinates, relative to the current element's origin. (Inherited from UIElement.)
Public method InvalidateArrangeInvalidates the arrange state (layout) for the element. After the invalidation, the element will have its layout updated, which will occur asynchronously unless subsequently forced by UpdateLayout. (Inherited from UIElement.)
Public method InvalidateMeasureInvalidates the measurement state (layout) for the element. (Inherited from UIElement.)
Public method InvalidatePropertyRe-evaluates the effective value for the specified dependency property (Inherited from DependencyObject.)
Public method InvalidateVisualInvalidates the rendering of the element, and forces a complete new layout pass. OnRender is called after the layout cycle is completed. (Inherited from UIElement.)
Public method IsAncestorOfDetermines whether the visual object is an ancestor of the descendant visual object. (Inherited from Visual.)
Public method IsDescendantOfDetermines whether the visual object is a descendant of the ancestor visual object. (Inherited from Visual.)
Public method MeasureUpdates the DesiredSize of a UIElement. Parent elements call this method from their own MeasureCore implementations to form a recursive layout update. Calling this method constitutes the first pass (the "Measure" pass) of a layout update. (Inherited from UIElement.)
Public method MoveFocusMoves the keyboard focus away from this element and to another element in a provided traversal direction. (Inherited from FrameworkElement.)
Public method OnApplyTemplateWhen overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate. (Inherited from FrameworkElement.)
Protected method OnRenderSizeChangedRaises the SizeChanged event, using the specified information as part of the eventual event data. (Inherited from FrameworkElement.)
Protected method OnStyleChangedInvoked when the style in use on this element changes, which will invalidate the layout. (Inherited from FrameworkElement.)
Protected method OnVisualChildrenChangedCalled when the VisualCollection of the visual object is modified. (Inherited from Visual.)
Protected method OnVisualParentChangedInvoked when the parent of this element in the visual tree is changed. Overrides OnVisualParentChanged. (Inherited from FrameworkElement.)
Protected method ParentLayoutInvalidated Supports incremental layout implementations in specialized subclasses of FrameworkElement. ParentLayoutInvalidated is invoked when a child element has invalidated a property that is marked in metadata as affecting the parent's measure or arrange passes during layout. (Inherited from FrameworkElement.)
Public method PointFromScreenConverts a Point in screen coordinates into a Point that represents the current coordinate system of the Visual. (Inherited from Visual.)
Public method PointToScreenConverts a Point that represents the current coordinate system of the Visual into a Point in screen coordinates. (Inherited from Visual.)
Public method PredictFocusDetermines the next element that would receive focus relative to this element for a provided focus movement direction, but does not actually move the focus. (Inherited from FrameworkElement.)
Public method RaiseEventRaises a specific routed event. The RoutedEvent to be raised is identified within the RoutedEventArgs instance that is provided (as the RoutedEvent property of that event data). (Inherited from UIElement.)
Public method ReadLocalValueReturns the local value of a dependency property, if it exists. (Inherited from DependencyObject.)
Public method RegisterNameProvides an accessor that simplifies access to the NameScope registration method. (Inherited from FrameworkElement.)
Public method ReleaseAllTouchCapturesReleases all captured touch devices from this element. (Inherited from UIElement.)
Public method ReleaseMouseCapture Releases the mouse capture, if this element held the capture. (Inherited from UIElement.)
Public method ReleaseStylusCapture Releases the stylus device capture, if this element held the capture. (Inherited from UIElement.)
Public method ReleaseTouchCaptureAttempts to release the specified touch device from this element. (Inherited from UIElement.)
Public method RemoveHandler Removes the specified routed event handler from this element. (Inherited from UIElement.)
Protected method RemoveLogicalChildRemoves the provided object from this element's logical tree. FrameworkElement updates the affected logical tree parent pointers to keep in sync with this deletion. (Inherited from FrameworkElement.)
Public method SetBinding(DependencyProperty, String)Attaches a binding to this element, based on the provided source property name as a path qualification to the data source. (Inherited from FrameworkElement.)
Public method SetBinding(DependencyProperty, BindingBase)Attaches a binding to this element, based on the provided binding object. (Inherited from FrameworkElement.)
Public method SetCurrentValueSets the value of a dependency property without changing its value source. (Inherited from DependencyObject.)
Public method SetResourceReferenceSearches for a resource with the specified name and sets up a resource reference to it for the specified property. (Inherited from FrameworkElement.)
Public method SetValue(DependencyProperty, Object)Sets the local value of a dependency property, specified by its dependency property identifier. (Inherited from DependencyObject.)
Public method SetValue(DependencyPropertyKey, Object)Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property. (Inherited from DependencyObject.)
Public method ShouldSerializeCommandBindingsReturns whether serialization processes should serialize the contents of the CommandBindings property on instances of this class. (Inherited from UIElement.)
Public method ShouldSerializeInputBindingsReturns whether serialization processes should serialize the contents of the InputBindings property on instances of this class. (Inherited from UIElement.)
Protected method ShouldSerializePropertyReturns a value that indicates whether serialization processes should serialize the value for the provided dependency property. (Inherited from DependencyObject.)
Public method ShouldSerializeResourcesReturns whether serialization processes should serialize the contents of the Resources property. (Inherited from FrameworkElement.)
Public method ShouldSerializeStyleReturns whether serialization processes should serialize the contents of the Style property. (Inherited from FrameworkElement.)
Public method ShouldSerializeTriggersReturns whether serialization processes should serialize the contents of the Triggers property. (Inherited from FrameworkElement.)
Public method ToStringReturns a string that represents the current object. (Inherited from Object.)
Public method TransformToAncestor(Visual)Returns a transform that can be used to transform coordinates from the Visual to the specified Visual ancestor of the visual object. (Inherited from Visual.)
Public method TransformToAncestor(Visual3D)Returns a transform that can be used to transform coordinates from the Visual to the specified Visual3D ancestor of the visual object. (Inherited from Visual.)
Public method TransformToDescendantReturns a transform that can be used to transform coordinates from the Visual to the specified visual object descendant. (Inherited from Visual.)
Public method TransformToVisualReturns a transform that can be used to transform coordinates from the Visual to the specified visual object. (Inherited from Visual.)
Public method TranslatePointTranslates a point relative to this element to coordinates that are relative to the specified element. (Inherited from UIElement.)
Public method TryFindResourceSearches for a resource with the specified key, and returns that resource if found. (Inherited from FrameworkElement.)
Public method UnregisterNameSimplifies access to the NameScope de-registration method. (Inherited from FrameworkElement.)
Public method UpdateDefaultStyleReapplies the default style to the current FrameworkElement. (Inherited from FrameworkElement.)
Public method UpdateLayoutEnsures that all visual child elements of this element are properly updated for layout. (Inherited from UIElement.)
Public method VerifyAccessEnforces that the calling thread has access to this DispatcherObject. (Inherited from DispatcherObject.)
Top
Events
  NameDescription
Public event ContextMenuClosingOccurs just before any context menu on the element is closed. (Inherited from FrameworkElement.)
Public event ContextMenuOpeningOccurs when any context menu on the element is opened. (Inherited from FrameworkElement.)
Public event DataContextChangedOccurs when the data context for this element changes. (Inherited from FrameworkElement.)
Public event DragEnterOccurs when the input system reports an underlying drag event with this element as the drag target. (Inherited from UIElement.)
Public event DragLeaveOccurs when the input system reports an underlying drag event with this element as the drag origin. (Inherited from UIElement.)
Public event DragOverOccurs when the input system reports an underlying drag event with this element as the potential drop target. (Inherited from UIElement.)
Public event DropOccurs when the input system reports an underlying drop event with this element as the drop target. (Inherited from UIElement.)
Public event FocusableChangedOccurs when the value of the Focusable property changes. (Inherited from UIElement.)
Public event GiveFeedbackOccurs when the input system reports an underlying drag-and-drop event that involves this element. (Inherited from UIElement.)
Public event GotFocusOccurs when this element gets logical focus. (Inherited from UIElement.)
Public event GotKeyboardFocusOccurs when the keyboard is focused on this element. (Inherited from UIElement.)
Public event GotMouseCaptureOccurs when this element captures the mouse. (Inherited from UIElement.)
Public event GotStylusCaptureOccurs when this element captures the stylus. (Inherited from UIElement.)
Public event GotTouchCaptureOccurs when a touch is captured to this element. (Inherited from UIElement.)
Public event InitializedOccurs when this FrameworkElement is initialized. This event coincides with cases where the value of the IsInitialized property changes from false (or undefined) to true. (Inherited from FrameworkElement.)
Public event IsEnabledChangedOccurs when the value of the IsEnabled property on this element changes. (Inherited from UIElement.)
Public event IsHitTestVisibleChangedOccurs when the value of the IsHitTestVisible dependency property changes on this element. (Inherited from UIElement.)
Public event IsKeyboardFocusedChangedOccurs when the value of the IsKeyboardFocused property changes on this element. (Inherited from UIElement.)
Public event IsKeyboardFocusWithinChangedOccurs when the value of the IsKeyboardFocusWithinChanged property changes on this element. (Inherited from UIElement.)
Public event IsMouseCapturedChangedOccurs when the value of the IsMouseCaptured property changes on this element. (Inherited from UIElement.)
Public event IsMouseCaptureWithinChangedOccurs when the value of the IsMouseCaptureWithinProperty changes on this element. (Inherited from UIElement.)
Public event IsMouseDirectlyOverChangedOccurs when the value of the IsMouseDirectlyOver property changes on this element. (Inherited from UIElement.)
Public event IsStylusCapturedChangedOccurs when the value of the IsStylusCaptured property changes on this element. (Inherited from UIElement.)
Public event IsStylusCaptureWithinChangedOccurs when the value of the IsStylusCaptureWithin property changes on this element. (Inherited from UIElement.)
Public event IsStylusDirectlyOverChangedOccurs when the value of the IsStylusDirectlyOver property changes on this element. (Inherited from UIElement.)
Public event IsVisibleChangedOccurs when the value of the IsVisible property changes on this element. (Inherited from UIElement.)
Public event KeyDownOccurs when a key is pressed while focus is on this element. (Inherited from UIElement.)
Public event KeyUpOccurs when a key is released while focus is on this element. (Inherited from UIElement.)
Public event LayoutUpdatedOccurs when the layout of the various visual elements associated with the current Dispatcher changes. (Inherited from UIElement.)
Public event LoadedOccurs when the element is laid out, rendered, and ready for interaction. (Inherited from FrameworkElement.)
Public event LostFocusOccurs when this element loses logical focus. (Inherited from UIElement.)
Public event LostKeyboardFocusOccurs when the keyboard is no longer focused on this element,. (Inherited from UIElement.)
Public event LostMouseCaptureOccurs when this element loses mouse capture. (Inherited from UIElement.)
Public event LostStylusCaptureOccurs when this element loses stylus capture. (Inherited from UIElement.)
Public event LostTouchCaptureOccurs when this element loses a touch capture. (Inherited from UIElement.)
Public event ManipulationBoundaryFeedbackOccurs when the manipulation encounters a boundary. (Inherited from UIElement.)
Public event ManipulationCompletedOccurs when a manipulation and inertia on the UIElement object is complete. (Inherited from UIElement.)
Public event ManipulationDeltaOccurs when the input device changes position during a manipulation. (Inherited from UIElement.)
Public event ManipulationInertiaStartingOccurs when the input device loses contact with the UIElement object during a manipulation and inertia begins. (Inherited from UIElement.)
Public event ManipulationStartedOccurs when an input device begins a manipulation on the UIElement object. (Inherited from UIElement.)
Public event ManipulationStartingOccurs when the manipulation processor is first created. (Inherited from UIElement.)
Public event MouseDownOccurs when any mouse button is pressed while the pointer is over this element. (Inherited from UIElement.)
Public event MouseEnterOccurs when the mouse pointer enters the bounds of this element. (Inherited from UIElement.)
Public event MouseLeaveOccurs when the mouse pointer leaves the bounds of this element. (Inherited from UIElement.)
Public event MouseLeftButtonDownOccurs when the left mouse button is pressed while the mouse pointer is over this element. (Inherited from UIElement.)
Public event MouseLeftButtonUpOccurs when the left mouse button is released while the mouse pointer is over this element. (Inherited from UIElement.)
Public event MouseMoveOccurs when the mouse pointer moves while over this element. (Inherited from UIElement.)
Public event MouseRightButtonDownOccurs when the right mouse button is pressed while the mouse pointer is over this element. (Inherited from UIElement.)
Public event MouseRightButtonUpOccurs when the right mouse button is released while the mouse pointer is over this element. (Inherited from UIElement.)
Public event MouseUpOccurs when any mouse button is released over this element. (Inherited from UIElement.)
Public event MouseWheelOccurs when the user rotates the mouse wheel while the mouse pointer is over this element. (Inherited from UIElement.)
Public event PreviewDragEnterOccurs when the input system reports an underlying drag event with this element as the drag target. (Inherited from UIElement.)
Public event PreviewDragLeaveOccurs when the input system reports an underlying drag event with this element as the drag origin. (Inherited from UIElement.)
Public event PreviewDragOverOccurs when the input system reports an underlying drag event with this element as the potential drop target. (Inherited from UIElement.)
Public event PreviewDropOccurs when the input system reports an underlying drop event with this element as the drop target. (Inherited from UIElement.)
Public event PreviewGiveFeedbackOccurs when a drag-and-drop operation is started. (Inherited from UIElement.)
Public event PreviewGotKeyboardFocusOccurs when the keyboard is focused on this element. (Inherited from UIElement.)
Public event PreviewKeyDownOccurs when a key is pressed while focus is on this element. (Inherited from UIElement.)
Public event PreviewKeyUpOccurs when a key is released while focus is on this element. (Inherited from UIElement.)
Public event PreviewLostKeyboardFocusOccurs when the keyboard is no longer focused on this element. (Inherited from UIElement.)
Public event PreviewMouseDownOccurs when any mouse button is pressed while the pointer is over this element. (Inherited from UIElement.)
Public event PreviewMouseLeftButtonDownOccurs when the left mouse button is pressed while the mouse pointer is over this element. (Inherited from UIElement.)
Public event PreviewMouseLeftButtonUpOccurs when the left mouse button is released while the mouse pointer is over this element. (Inherited from UIElement.)
Public event PreviewMouseMoveOccurs when the mouse pointer moves while the mouse pointer is over this element. (Inherited from UIElement.)
Public event PreviewMouseRightButtonDownOccurs when the right mouse button is pressed while the mouse pointer is over this element. (Inherited from UIElement.)
Public event PreviewMouseRightButtonUpOccurs when the right mouse button is released while the mouse pointer is over this element. (Inherited from UIElement.)
Public event PreviewMouseUpOccurs when any mouse button is released while the mouse pointer is over this element. (Inherited from UIElement.)
Public event PreviewMouseWheelOccurs when the user rotates the mouse wheel while the mouse pointer is over this element. (Inherited from UIElement.)
Public event PreviewQueryContinueDragOccurs when there is a change in the keyboard or mouse button state during a drag-and-drop operation. (Inherited from UIElement.)
Public event PreviewStylusButtonDownOccurs when the stylus button is pressed while the pointer is over this element. (Inherited from UIElement.)
Public event PreviewStylusButtonUpOccurs when the stylus button is released while the pointer is over this element. (Inherited from UIElement.)
Public event PreviewStylusDownOccurs when the stylus touches the digitizer while it is over this element. (Inherited from UIElement.)
Public event PreviewStylusInAirMoveOccurs when the stylus moves over an element without actually touching the digitizer. (Inherited from UIElement.)
Public event PreviewStylusInRangeOccurs when the stylus is close enough to the digitizer to be detected, while over this element. (Inherited from UIElement.)
Public event PreviewStylusMoveOccurs when the stylus moves while over the element. The stylus must move while being detected by the digitizer to raise this event, otherwise, PreviewStylusInAirMove is raised instead. (Inherited from UIElement.)
Public event PreviewStylusOutOfRangeOccurs when the stylus is too far from the digitizer to be detected. (Inherited from UIElement.)
Public event PreviewStylusSystemGestureOccurs when a user performs one of several stylus gestures. (Inherited from UIElement.)
Public event PreviewStylusUpOccurs when the user raises the stylus off the digitizer while the stylus is over this element. (Inherited from UIElement.)
Public event PreviewTextInputOccurs when this element gets text in a device-independent manner. (Inherited from UIElement.)
Public event PreviewTouchDownOccurs when a finger touches the screen while the finger is over this element. (Inherited from UIElement.)
Public event PreviewTouchMoveOccurs when a finger moves on the screen while the finger is over this element. (Inherited from UIElement.)
Public event PreviewTouchUpOccurs when a finger is raised off of the screen while the finger is over this element. (Inherited from UIElement.)
Public event QueryContinueDragOccurs when there is a change in the keyboard or mouse button state during a drag-and-drop operation. (Inherited from UIElement.)
Public event QueryCursorOccurs when the cursor is requested to display. This event is raised on an element each time that the mouse pointer moves to a new location, which means the cursor object might need to be changed based on its new position. (Inherited from UIElement.)
Public event RequestBringIntoViewOccurs when BringIntoView is called on this element. (Inherited from FrameworkElement.)
Public event SizeChangedOccurs when either the ActualHeight or the ActualWidth properties change value on this element. (Inherited from FrameworkElement.)
Public event SourceUpdatedOccurs when the source value changes for any existing property binding on this element. (Inherited from FrameworkElement.)
Public event StylusButtonDownOccurs when the stylus button is pressed while the pointer is over this element. (Inherited from UIElement.)
Public event StylusButtonUpOccurs when the stylus button is released while the pointer is over this element. (Inherited from UIElement.)
Public event StylusDownOccurs when the stylus touches the digitizer while the stylus is over this element. (Inherited from UIElement.)
Public event StylusEnterOccurs when the stylus enters the bounds of this element. (Inherited from UIElement.)
Public event StylusInAirMoveOccurs when the stylus moves over an element without actually touching the digitizer. (Inherited from UIElement.)
Public event StylusInRangeOccurs when the stylus is close enough to the digitizer to be detected, while over this element. (Inherited from UIElement.)
Public event StylusLeaveOccurs when the stylus leaves the bounds of the element. (Inherited from UIElement.)
Public event StylusMoveOccurs when the stylus moves over this element. The stylus must move while on the digitizer to raise this event. Otherwise, StylusInAirMove is raised instead. (Inherited from UIElement.)
Public event StylusOutOfRangeOccurs when the stylus is too far from the digitizer to be detected, while over this element. (Inherited from UIElement.)
Public event StylusSystemGestureOccurs when a user performs one of several stylus gestures. (Inherited from UIElement.)
Public event StylusUpOccurs when the user raises the stylus off the digitizer while it is over this element. (Inherited from UIElement.)
Public event TargetUpdatedOccurs when the target value changes for any property binding on this element. (Inherited from FrameworkElement.)
Public event TextInputOccurs when this element gets text in a device-independent manner. (Inherited from UIElement.)
Public event ToolTipClosingOccurs just before any tooltip on the element is closed. (Inherited from FrameworkElement.)
Public event ToolTipOpeningOccurs when any tooltip on the element is opened. (Inherited from FrameworkElement.)
Public event TouchDownOccurs when a finger touches the screen while the finger is over this element. (Inherited from UIElement.)
Public event TouchEnterOccurs when a touch moves from outside to inside the bounds of this element. (Inherited from UIElement.)
Public event TouchLeaveOccurs when a touch moves from inside to outside the bounds of this element. (Inherited from UIElement.)
Public event TouchMoveOccurs when a finger moves on the screen while the finger is over this element. (Inherited from UIElement.)
Public event TouchUpOccurs when a finger is raised off of the screen while the finger is over this element. (Inherited from UIElement.)
Public event UnloadedOccurs when the element is removed from within an element tree of loaded elements. (Inherited from FrameworkElement.)
Top
Fields
  NameDescription
Public field Static member RadiusXPropertyIdentifies the RadiusX dependency property.
Public field Static member RadiusYPropertyIdentifies the RadiusY dependency property.
Top
Explicit Interface Implementations
  NameDescription
Explicit interface implemetation Private method IQueryAmbientIsAmbientPropertyAvailableFor a description of this member, see the IsAmbientPropertyAvailable method. (Inherited from FrameworkElement.)
Top
Examples

The following example shows how to create a Rectangle element and set its properties by using code.


'Add a Rectangle Element 
Dim myRect As New Rectangle()
myRect.Stroke = Brushes.Black
myRect.Stroke = Brushes.Black
myRect.Fill = Brushes.SkyBlue
myRect.HorizontalAlignment = HorizontalAlignment.Left
myRect.VerticalAlignment = VerticalAlignment.Center
myRect.Height = 50
myRect.Width = 50
myGrid.Children.Add(myRect)

// Add a Rectangle Element
myRect = new System.Windows.Shapes.Rectangle();
myRect.Stroke = System.Windows.Media.Brushes.Black;
myRect.Fill = System.Windows.Media.Brushes.SkyBlue;
myRect.HorizontalAlignment = HorizontalAlignment.Left;
myRect.VerticalAlignment = VerticalAlignment.Center;
myRect.Height = 50;
myRect.Width = 50;
myGrid.Children.Add(myRect);
// Add a Rectangle Element
myRect = gcnew Rectangle();
myRect->Stroke = Brushes::Black;
myRect->Fill = Brushes::SkyBlue;
myRect->HorizontalAlignment = HorizontalAlignment::Left;
myRect->VerticalAlignment = VerticalAlignment::Center;
myRect->Height = 50;
myRect->Width = 50;
myGrid->Children->Add(myRect);

More Code

How to: Draw a RectangleThis example shows how to draw a rectangle by using the Rectangle element.
Version Information

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Platforms

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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.