Setter.TargetName Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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); };
public string TargetName { get; set; }
[System.Windows.Markup.Ambient]
public string TargetName { get; set; }
member this.TargetName : string with get, set
[<System.Windows.Markup.Ambient>]
member this.TargetName : string with get, set
Public Property TargetName As String
Property Value
The default value is null
.
- Attributes
Examples
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>
Remarks
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. This is typically a named element that is within the template that contains this setter.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기