I want to redesign my ToggleButton. I create the ToggleButton in xaml:
<ToggleButton Width="15" Grid.Column="2" />
And have the ToggleButton Style in the Resources:
<Style TargetType="ToggleButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Path Name="Arrow" Fill="Black" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 0 0 L 4 4 L 8 0 Z" />
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="true">
<Setter TargetName="Arrow" Property="Data" Value="M 0 4 L 4 0 L 8 4 Z" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
When I'm try to build i've got this error:
Cannot find the Template Property 'IsChecked' on the type 'System.Windows.Controls.Control'.
How can I solve the problem?
也给ControlTemplate
指定TargetType
<ControlTemplate TargetType="ToggleButton">
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.