就是想不通,所以问下各位大神
<Button Width="100" Height="30" Content="World"> <Button.Style> <Style TargetType="Button"> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Content"> <Setter.Value> <TextBlock Text="Hello"></TextBlock> </Setter.Value> </Setter> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button>
这样为什么没有效果?
<Button Content="before mouse over" Height="50" Width="150"
HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border CornerRadius="5" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"
BorderThickness="1" BorderBrush="Black" Background="{TemplateBinding Background}"
Style="{TemplateBinding Style}">
<ContentPresenter x:Name="contentpre01" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Content" TargetName="contentpre01" Value="after mouse over"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
给你个思路,剩下的自己研究呗。
3Q,谢啦