我已经尝试为textbox实现controltemplate和datatriggers .. Xaml代码如下:
<TextBox x:Uid="txtagevals" x:Name="txtAge" Height="25" Width="80" Background="Wheat" BorderThickness="1" BorderBrush="Black">
<TextBox.Template>
<ControlTemplate x:Uid ="txtagevals" TargetType="{x:Type TextBox}">
<Border Background="{TemplateBinding Background}"
BorderBrush="Black" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="5">
<ScrollViewer x:Name="PART_ContentHost"/>
</Border>
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding Age}" Value="18">
<Setter **TargetName=""** Property="Text" Value="Green" />
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</TextBox.Template>
</TextBox>
你能不能帮助我......在上面的代码中应该是我的目标名称=“” ...谢谢你..