HeaderedContentControl.HeaderTemplate 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
컨트롤의 헤더 내용을 표시하는 데 사용되는 템플릿을 가져오거나 설정합니다.
public:
property System::Windows::DataTemplate ^ HeaderTemplate { System::Windows::DataTemplate ^ get(); void set(System::Windows::DataTemplate ^ value); };
[System.ComponentModel.Bindable(true)]
public System.Windows.DataTemplate HeaderTemplate { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.HeaderTemplate : System.Windows.DataTemplate with get, set
Public Property HeaderTemplate As DataTemplate
속성 값
데이터 템플릿입니다. 기본값은 null입니다.
- 특성
예제
다음 예제에서는 두 DataTemplate 개체를 만들어 해당 개체의 Header 모양을 지정합니다 ContentHeaderedContentControl.
<Style TargetType="HeaderedContentControl">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type HeaderedContentControl}">
<StackPanel>
<Grid>
<Rectangle Stroke="{TemplateBinding Background}"/>
<ContentPresenter ContentSource="Header"/>
</Grid>
<Grid>
<Rectangle Fill="{TemplateBinding Background}"/>
<ContentPresenter ContentSource="Content"/>
</Grid>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<DataTemplate x:Key="titleText">
<TextBlock Text="{Binding}"
Foreground="Green"
FontSize="16"
FontWeight="Normal"
FontStyle="Italic"
TextWrapping="Wrap"/>
</DataTemplate>
<DataTemplate x:Key="contentText">
<TextBlock Text="{Binding}"
Foreground="Brown"
FontSize="12"
FontWeight="Normal"
FontFamily="Arial Narrow"
TextWrapping="Wrap"/>
</DataTemplate>
<HeaderedContentControl Name="hcontCtrl" Background="Beige"
HeaderTemplate="{StaticResource titleText}"
ContentTemplate="{StaticResource contentText}"
Header="This is the header."
Content="This is the content."/>
설명
XAML 특성 사용
<object HeaderTemplate="{ResourceExtension TemplateResourceKey}"/>
XAML 속성 요소 사용
XAML 값
ResourceExtension 다음 중 하나: StaticResource또는 DynamicResource.
XAML 리소스를 참조하세요.
TemplateResourceKey 요청되는 템플릿을 식별하는 키입니다. 키는 에 있는 기존 리소스를 참조합니다 ResourceDictionary.
메모
속성 요소 구문은 기술적으로 가능하지만 권장되지는 않습니다. 인라인 스타일 및 템플릿을 참조하세요. 바인딩 참조를 사용하거나 사용할 수도 있지만 일반적이지는 않습니다.
종속성 속성 정보
| 항목 | 가치 |
|---|---|
| 식별자 필드 | HeaderTemplateProperty |
메타데이터 속성이 다음으로 설정됩니다. true |
None |