Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
318 lines (300 sloc) 19.7 KB
<Type Name="Decorator" FullName="System.Windows.Controls.Decorator">
<TypeSignature Language="C#" Value="public class Decorator : System.Windows.FrameworkElement, System.Windows.Markup.IAddChild" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit Decorator extends System.Windows.FrameworkElement implements class System.Windows.Markup.IAddChild" />
<TypeSignature Language="DocId" Value="T:System.Windows.Controls.Decorator" />
<TypeSignature Language="VB.NET" Value="Public Class Decorator&#xA;Inherits FrameworkElement&#xA;Implements IAddChild" />
<TypeSignature Language="C++ CLI" Value="public ref class Decorator : System::Windows::FrameworkElement, System::Windows::Markup::IAddChild" />
<TypeSignature Language="F#" Value="type Decorator = class&#xA; inherit FrameworkElement&#xA; interface IAddChild" />
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Windows.FrameworkElement</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>System.Windows.Markup.IAddChild</InterfaceName>
</Interface>
</Interfaces>
<Attributes>
<Attribute>
<AttributeName>System.Windows.Localizability(System.Windows.LocalizationCategory.Ignore, Readability=System.Windows.Readability.Unreadable)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Windows.Markup.ContentProperty("Child")</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Provides a base class for elements that apply effects onto or around a single child element, such as <see cref="T:System.Windows.Controls.Border" /> or <see cref="T:System.Windows.Controls.Viewbox" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A <xref:System.Windows.Controls.Decorator> contains a single <xref:System.Windows.UIElement>, which is specified by the <xref:System.Windows.Controls.Decorator.Child%2A> property. The <xref:System.Windows.Controls.Decorator> affects, or decorates, the <xref:System.Windows.UIElement>. The <xref:System.Windows.Controls.Decorator> may or may not have an appearance. For example, a <xref:System.Windows.Controls.Border> puts a rectangle around a control, but a <xref:System.Windows.Controls.Viewbox> has no visual presence.
## Examples
The following example adds a <xref:System.Windows.Controls.TextBox> the <xref:System.Windows.Controls.Decorator.Child%2A> property of a <xref:System.Windows.Controls.Border>.
**Note** The [!INCLUDE[TLA#tla_xaml](~/includes/tlasharptla-xaml-md.md)] version of the example could use the `<Border.Child>` tags around the content of the <xref:System.Windows.Controls.Border>, but it is not necessary because the <xref:System.Windows.Controls.Decorator> applies the <xref:System.Windows.Markup.ContentPropertyAttribute> to the <xref:System.Windows.Controls.Decorator.Child%2A> property. For more information, see [XAML Overview (WPF)](~/docs/framework/wpf/advanced/xaml-overview-wpf.md).
[!code-xaml[Border_snip#SimpleBorderWholePage](~/samples/snippets/csharp/VS_Snippets_Wpf/Border_snip/CS/simpleborder.xaml#simpleborderwholepage)]
[!code-csharp[Border_Procedural_snip#BasicBorderCodeExampleWholePage](~/samples/snippets/csharp/VS_Snippets_Wpf/Border_Procedural_snip/CSharp/BasicBorderExample.cs#basicbordercodeexamplewholepage)]
[!code-vb[Border_Procedural_snip#BasicBorderCodeExampleWholePage](~/samples/snippets/visualbasic/VS_Snippets_Wpf/Border_Procedural_snip/visualbasic/basicborderexample.vb#basicbordercodeexamplewholepage)]
The preceding example produces output that is similar to the following illustration.
![TextBox with black border](~/add/media/layout-border-around-textbox.png "TextBox with black border")
Border around a TextBox
]]></format>
</remarks>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public Decorator ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Controls.Decorator.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; Decorator();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Windows.Controls.Decorator" /> class.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="ArrangeOverride">
<MemberSignature Language="C#" Value="protected override System.Windows.Size ArrangeOverride (System.Windows.Size arrangeSize);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance valuetype System.Windows.Size ArrangeOverride(valuetype System.Windows.Size arrangeSize) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Controls.Decorator.ArrangeOverride(System.Windows.Size)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Function ArrangeOverride (arrangeSize As Size) As Size" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override System::Windows::Size ArrangeOverride(System::Windows::Size arrangeSize);" />
<MemberSignature Language="F#" Value="override this.ArrangeOverride : System.Windows.Size -&gt; System.Windows.Size" Usage="decorator.ArrangeOverride arrangeSize" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Size</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="arrangeSize" Type="System.Windows.Size" />
</Parameters>
<Docs>
<param name="arrangeSize">The <see cref="T:System.Windows.Size" /> this element uses to arrange its child content.</param>
<summary>Arranges the content of a <see cref="T:System.Windows.Controls.Decorator" /> element.</summary>
<returns>The <see cref="T:System.Windows.Size" /> that represents the arranged size of this <see cref="T:System.Windows.Controls.Decorator" /> element and its child.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Child">
<MemberSignature Language="C#" Value="public virtual System.Windows.UIElement Child { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Windows.UIElement Child" />
<MemberSignature Language="DocId" Value="P:System.Windows.Controls.Decorator.Child" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property Child As UIElement" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::Windows::UIElement ^ Child { System::Windows::UIElement ^ get(); void set(System::Windows::UIElement ^ value); };" />
<MemberSignature Language="F#" Value="member this.Child : System.Windows.UIElement with get, set" Usage="System.Windows.Controls.Decorator.Child" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(null)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.UIElement</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the single child element of a <see cref="T:System.Windows.Controls.Decorator" />.</summary>
<value>The single child element of a <see cref="T:System.Windows.Controls.Decorator" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Windows.Controls.Decorator> enforces a strong content model for child content. The <xref:System.Windows.Controls.Decorator.Child%2A> property of a <xref:System.Windows.Controls.Decorator> must be a single <xref:System.Windows.UIElement>.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="GetVisualChild">
<MemberSignature Language="C#" Value="protected override System.Windows.Media.Visual GetVisualChild (int index);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance class System.Windows.Media.Visual GetVisualChild(int32 index) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Controls.Decorator.GetVisualChild(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Function GetVisualChild (index As Integer) As Visual" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override System::Windows::Media::Visual ^ GetVisualChild(int index);" />
<MemberSignature Language="F#" Value="override this.GetVisualChild : int -&gt; System.Windows.Media.Visual" Usage="decorator.GetVisualChild index" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Media.Visual</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
</Parameters>
<Docs>
<param name="index">Index position of the child element.</param>
<summary>Gets the child <see cref="T:System.Windows.Media.Visual" /> element at the specified <paramref name="index" /> position.</summary>
<returns>The child element at the specified <paramref name="index" /> position.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Because <xref:System.Windows.Controls.Decorator.Child%2A> can equal only 0 or 1, specifying an `index` position greater than 1 or less than 0 results in an <xref:System.ArgumentOutOfRangeException>.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="index" /> is greater than the number of visual child elements.</exception>
</Docs>
</Member>
<Member MemberName="LogicalChildren">
<MemberSignature Language="C#" Value="protected internal override System.Collections.IEnumerator LogicalChildren { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.IEnumerator LogicalChildren" />
<MemberSignature Language="DocId" Value="P:System.Windows.Controls.Decorator.LogicalChildren" />
<MemberSignature Language="VB.NET" Value="Protected Friend Overrides ReadOnly Property LogicalChildren As IEnumerator" />
<MemberSignature Language="C++ CLI" Value="protected public:&#xA; virtual property System::Collections::IEnumerator ^ LogicalChildren { System::Collections::IEnumerator ^ get(); };" />
<MemberSignature Language="F#" Value="member this.LogicalChildren : System.Collections.IEnumerator" Usage="System.Windows.Controls.Decorator.LogicalChildren" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Collections.IEnumerator</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets an enumerator that can be used to iterate the logical child elements of a <see cref="T:System.Windows.Controls.Decorator" />.</summary>
<value>An enumerator that can be used to iterate the logical child elements of a <see cref="T:System.Windows.Controls.Decorator" />.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="MeasureOverride">
<MemberSignature Language="C#" Value="protected override System.Windows.Size MeasureOverride (System.Windows.Size constraint);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance valuetype System.Windows.Size MeasureOverride(valuetype System.Windows.Size constraint) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Controls.Decorator.MeasureOverride(System.Windows.Size)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Function MeasureOverride (constraint As Size) As Size" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override System::Windows::Size MeasureOverride(System::Windows::Size constraint);" />
<MemberSignature Language="F#" Value="override this.MeasureOverride : System.Windows.Size -&gt; System.Windows.Size" Usage="decorator.MeasureOverride constraint" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Size</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="constraint" Type="System.Windows.Size" />
</Parameters>
<Docs>
<param name="constraint">An upper limit <see cref="T:System.Windows.Size" /> that should not be exceeded.</param>
<summary>Measures the child element of a <see cref="T:System.Windows.Controls.Decorator" /> to prepare for arranging it during the <see cref="M:System.Windows.Controls.Decorator.ArrangeOverride(System.Windows.Size)" /> pass.</summary>
<returns>The target <see cref="T:System.Windows.Size" /> of the element.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A <xref:System.Windows.Controls.Decorator> determines its desired size by analyzing its child element's sizing properties, margin, and requested size.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="System.Windows.Markup.IAddChild.AddChild">
<MemberSignature Language="C#" Value="void IAddChild.AddChild (object value);" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.Windows.Markup.IAddChild.AddChild(object value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Controls.Decorator.System#Windows#Markup#IAddChild#AddChild(System.Object)" />
<MemberSignature Language="VB.NET" Value="Sub AddChild (value As Object) Implements IAddChild.AddChild" />
<MemberSignature Language="C++ CLI" Value=" virtual void System.Windows.Markup.IAddChild.AddChild(System::Object ^ value) = System::Windows::Markup::IAddChild::AddChild;" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Windows.Markup.IAddChild.AddChild(System.Object)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.Object" />
</Parameters>
<Docs>
<param name="value">An object to add as a child.</param>
<summary>This type or member supports the [!INCLUDE[TLA#tla_winclient](~/includes/tlasharptla-winclient-md.md)] infrastructure and is not intended to be used directly from your code.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="System.Windows.Markup.IAddChild.AddText">
<MemberSignature Language="C#" Value="void IAddChild.AddText (string text);" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.Windows.Markup.IAddChild.AddText(string text) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Controls.Decorator.System#Windows#Markup#IAddChild#AddText(System.String)" />
<MemberSignature Language="VB.NET" Value="Sub AddText (text As String) Implements IAddChild.AddText" />
<MemberSignature Language="C++ CLI" Value=" virtual void System.Windows.Markup.IAddChild.AddText(System::String ^ text) = System::Windows::Markup::IAddChild::AddText;" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Windows.Markup.IAddChild.AddText(System.String)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="text" Type="System.String" />
</Parameters>
<Docs>
<param name="text">A string to add to the object.</param>
<summary>This type or member supports the [!INCLUDE[TLA#tla_winclient](~/includes/tlasharptla-winclient-md.md)] infrastructure and is not intended to be used directly from your code.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="VisualChildrenCount">
<MemberSignature Language="C#" Value="protected override int VisualChildrenCount { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 VisualChildrenCount" />
<MemberSignature Language="DocId" Value="P:System.Windows.Controls.Decorator.VisualChildrenCount" />
<MemberSignature Language="VB.NET" Value="Protected Overrides ReadOnly Property VisualChildrenCount As Integer" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual property int VisualChildrenCount { int get(); };" />
<MemberSignature Language="F#" Value="member this.VisualChildrenCount : int" Usage="System.Windows.Controls.Decorator.VisualChildrenCount" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value that is equal to the number of visual child elements of this instance of <see cref="T:System.Windows.Controls.Decorator" />.</summary>
<value>The number of visual child elements.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Because a <xref:System.Windows.Controls.Decorator> can have only one child object in its child collection, this property always reports 0 or 1.
]]></format>
</remarks>
</Docs>
</Member>
</Members>
</Type>
You can’t perform that action at this time.