信息
您所需的主题如下所示。但此主题未包含在此库中。

Control.Template 属性

Gets or sets a control template.

命名空间: System.Windows.Controls
程序集: PresentationFramework(在 presentationframework.dll 中)
XML 命名空间:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public ControlTemplate Template { get; set; }
/** @property */
public ControlTemplate get_Template ()

/** @property */
public void set_Template (ControlTemplate value)

public function get Template () : ControlTemplate

public function set Template (value : ControlTemplate)

<object>
  <object.Template>
    <ControlTemplate .../>
  </object.Template>
</object>

属性值

A Template.

Identifier Field

TemplateProperty

Metadata Flags

AffectsMeasure

The control author defines the default control template and the application author can override the ControlTemplate to redefine the visual tree of the control. See ControlTemplate Examples for information and examples of how to change the visual tree of existing controls.

A ControlTemplate is intended to be a self-contained unit of implementation detail that is invisible to outside users and objects, including Style objects. The only way to manipulate the content of the control template is from within the same control template.

The following example shows how to create a control template and use it with a button control.

<ControlTemplate x:Key="template1">
  <TextBlock Text="Control Template" FontSize="12" FontWeight="Bold" TextWrapping="Wrap">
  </TextBlock>  
</ControlTemplate>

<Button Name="btn12">
      <Control Template="{StaticResource template1}"/>
</Button>

Windows Vista、Microsoft Windows XP SP2 和 Windows Server 2003 SP1 支持 Microsoft .NET Framework 3.0。

.NET Framework

受以下版本支持:3.0

社区附加资源

显示:
© 2015 Microsoft