Setter.TargetName 속성

정의

Setter가 사용되는 개체의 이름을 가져오거나 설정합니다.Gets or sets the name of the object this Setter is intended for.

public:
 property System::String ^ TargetName { System::String ^ get(); void set(System::String ^ value); };
[System.Windows.Markup.Ambient]
public string TargetName { get; set; }
public string TargetName { get; set; }
member this.TargetName : string with get, set
Public Property TargetName As String

속성 값

기본값은 null입니다.The default value is null.

특성

예제

다음 TargetName 예에서는 트리거 Setter에 사용 되어 Setter ThumbCover 내에서 이름이 ControlTemplateEllipse에 대 한 것으로 지정 합니다.In the following example, the TargetName is used for the trigger Setter to specify that the Setter is intended for the Ellipse named ThumbCover within the ControlTemplate.

<Style x:Key="Slider_Thumb" TargetType="{x:Type Thumb}">
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="Width" Value="14" />
    <Setter Property="Height" Value="14" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type Thumb}">
                <Grid Width="14" Height="14">
                    <Ellipse Fill="{TemplateBinding Foreground}" />
                    <Ellipse Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" x:Name="ThumbCover" >
                        <Ellipse.Fill>
                            <LinearGradientBrush  EndPoint="0,1" StartPoint="0,0">
                                <LinearGradientBrush.GradientStops>
                                    <GradientStop Color="#CCFFFFFF" Offset="0" />
                                    <GradientStop Color="#00000000" Offset=".5" />
                                    <GradientStop Color="#66000000" Offset="1" />
                                </LinearGradientBrush.GradientStops>
                            </LinearGradientBrush>
                        </Ellipse.Fill>
                    </Ellipse>
                </Grid>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsDragging" Value="true">
                        <Setter TargetName="ThumbCover" Property="Fill">
                            <Setter.Value>
                                <LinearGradientBrush  EndPoint="0,1" StartPoint="0,0">
                                    <LinearGradientBrush.GradientStops>
                                        <GradientStop Color="#CCFFFFFF" Offset="1" />
                                        <GradientStop Color="#00000000" Offset=".5" />
                                        <GradientStop Color="#66000000" Offset="0" />
                                    </LinearGradientBrush.GradientStops>
                                </LinearGradientBrush>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

설명

이 속성의 setter 컬렉션 (컬렉션에이 setter의 일부)이 적용 되는 범위 내의 모든 요소 이름으로 설정할 수 있습니다.You can set this property to the name of any element within the scope of where the setter collection (the collection that this setter is part of) is applied. 이것이 일반적으로이 setter를 포함 하는 템플릿 내에 있는 명명된 된 요소입니다.This is typically a named element that is within the template that contains this setter.

적용 대상

추가 정보