Setter.Target Property


Gets or sets the path of a property on a target element to apply the Value to.

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

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

Property Value


The path of a property on a target element to apply the Value to.


This example shows how to use multiple Setter statements inside the VisualState.Setters property to apply discrete property value changes on various elements (without animations) when a VisualState is applied.

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

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

To update a value of an attached property, place the attached property path inside parentheses. This example shows how to update the RelativePanel.AlignRightWithPanel value on an element with the name 'TitleTextBlock'.

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


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


The Setter.Target property can be used in either a Style or a VisualState, but in different ways.

  • When used in a Style, the property that needs to be modified can be specified directly.
  • When used in VisualState, the Target property must be given a TargetPropertyPath (dotted syntax with a target element and property explicitly specified).

Applies to