Setter.Target 속성

정의

Value를 적용할 대상 요소의 속성 경로를 가져오거나 설정합니다.

public:
 property TargetPropertyPath ^ Target { TargetPropertyPath ^ get(); void set(TargetPropertyPath ^ value); };
TargetPropertyPath Target();

void Target(TargetPropertyPath value);
public TargetPropertyPath Target { get; set; }
var targetPropertyPath = setter.target;
setter.target = targetPropertyPath;
Public Property Target As TargetPropertyPath

속성 값

Value를 적용할 대상 요소의 속성 경로입니다.

예제

이 예제에서는 VisualState.Setters 속성 내에서 여러 Setter 문을 사용하여 VisualState 가 적용될 때 다양한 요소(애니메이션 없이)에 불연속 속성 값 변경 내용을 적용하는 방법을 보여 줍니다.

<Page>
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup>
                <VisualState x:Name="NarrowState">
                    <VisualState.Setters>
                        <Setter Target="myPanel.Orientation" Value="Vertical"/>
                        <Setter Target="myPanel.Width" Value="380"/>
                        <Setter Target="myTextBlock.MaxLines" Value="3"/>
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>

        <StackPanel x:Name="myPanel" Orientation="Horizontal">
            <TextBlock x:Name="myTextBlock" MaxLines="5" Style="{ThemeResource BodyTextBlockStyle}"/>
        </StackPanel>
    </Grid>
</Page>

연결된 속성의 값을 업데이트하려면 연결된 속성 경로를 괄호 안에 배치합니다. 이 예제에서는 'TitleTextBlock' 이름으로 요소의 값을 업데이트 RelativePanel.AlignRightWithPanel 하는 방법을 보여줍니다.

<RelativePanel>
    <TextBlock x:Name="TitleTextBlock" Text="Title"/>
</RelativePanel>

...

<Setter Target="TitleTextBlock.(RelativePanel.AlignRightWithPanel)" Value="True"/>

설명

Setter.Target 속성은 Style 또는 VisualState에서 사용할 수 있지만 다른 방식으로 사용할 수 있습니다.

  • Style에서 사용할 경우 수정해야 하는 속성을 직접 지정할 수 있습니다.
  • VisualState에서 사용되는 경우 Target 속성에 TargetPropertyPath(대상 요소 및 속성이 명시적으로 지정된 점선 구문)가 지정되어야 합니다.

적용 대상