ContentControl.ContentStringFormat 속성

정의

Content 속성이 문자열로 표시되는 경우 이 속성의 형식 지정 방법을 지정하는 합성 문자열을 가져오거나 설정합니다.

public:
 property System::String ^ ContentStringFormat { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Bindable(true)]
public string ContentStringFormat { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.ContentStringFormat : string with get, set
Public Property ContentStringFormat As String

속성 값

String

Content 속성이 문자열로 표시되는 경우 이 속성의 형식 지정 방법을 지정하는 합성 문자열입니다.

특성

예제

다음 예제에서는의 형식을 지정 DateTime 설정 하 여 개체를 ContentStringFormat 속성에는 Style 적용를 Style 2 Label 개체에서 상속 하는 ContentControl.

<StackPanel
  xmlns:sys="clr-namespace:System;assembly=mscorlib">

  <StackPanel.Resources>
    <Style x:Key="DateLabel" TargetType="Label">
      <Setter Property="ContentStringFormat" Value="dddd – d - MMMM"/>
    </Style>
  </StackPanel.Resources>

  <!--The results when the default culture is en-US
      is March 4, 2005.-->
  <Label Style="{StaticResource DateLabel}">
    <sys:DateTime>2004/3/4 13:6:55</sys:DateTime>
  </Label>

  <Label Style="{StaticResource DateLabel}">
    <x:Static Member="sys:DateTime.Now"/>
  </Label>

</StackPanel>

설명

ContentStringFormat 미리 정의 된, 복합 또는 사용자 지정 문자열 형식의 수 있습니다. 문자열 형식에 대 한 자세한 내용은 참조 하세요. 형식합니다. 설정 하는 경우는 ContentTemplate 또는 ContentTemplateSelector 의 속성을 ContentControlContentStringFormat 속성은 무시 됩니다.

적용 대상