首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > CAD教程 >

属性触发器有关问题请问

2013-11-30 
属性触发器问题请教Window x:ClassWpfApplication6.MainWindowxmlnshttp://schemas.microsoft.com/w

属性触发器问题请教

<Window x:Class="WpfApplication6.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <Style TargetType="{x:Type Button}">
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background" Value="Red"/>
                    <Setter Property="FontSize" Value="25"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>
    <WrapPanel>
        <Button Content="button1"/>
    </WrapPanel>
</Window>


代码如上,期望的结果是当鼠标移入按钮是改变背景色和字体大小,实际结果是鼠标移入,字体大小改变,背景色不变,请教一下大家,我问题出在哪?
[解决办法]
再改下controltemplate,因为button控件还有默认的trigger

热点排行