Windows phone 7 鼠标悬停的视觉状态不';我不能在WindowsPhone上工作

Windows phone 7 鼠标悬停的视觉状态不';我不能在WindowsPhone上工作,windows-phone-7,Windows Phone 7,这是我生成按钮样式的代码。我想在鼠标悬停期间将边框刷更改为黄绿色,但似乎没有效果。有人能告诉我代码有什么问题吗?这是我的密码 <Style x:Key="CustomButtonStyle" TargetType="Button"> <Setter Property="Template"> <Setter.Value> <ControlTemplate>

这是我生成按钮样式的代码。我想在鼠标悬停期间将边框刷更改为黄绿色,但似乎没有效果。有人能告诉我代码有什么问题吗?这是我的密码

    <Style x:Key="CustomButtonStyle" TargetType="Button">
        <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate>
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal">
                                    <Storyboard>
                                        <DoubleAnimation To="1" Duration="0:00:00.5" Storyboard.TargetName="NormalBackground" Storyboard.TargetProperty="Opacity"/>
                                        <DoubleAnimation To="0" Duration="0:00:00.5" Storyboard.TargetName="HoverBackground" Storyboard.TargetProperty="Opacity"/>
                                        <DoubleAnimation To="0" Duration="0:00:00.5" Storyboard.TargetName="PressedBackground" Storyboard.TargetProperty="Opacity"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation To="0" Duration="0:00:00.5" Storyboard.TargetName="NormalBackground" Storyboard.TargetProperty="Opacity"/>
                                        <DoubleAnimation To="1" Duration="0:00:00.5" Storyboard.TargetName="HoverBackground" Storyboard.TargetProperty="Opacity"/>
                                        <DoubleAnimation To="0" Duration="0:00:00.5" Storyboard.TargetName="PressedBackground" Storyboard.TargetProperty="Opacity"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation To="0" Duration="0:00:00.5" Storyboard.TargetName="NormalBackground" Storyboard.TargetProperty="Opacity"/>
                                        <DoubleAnimation To="0" Duration="0:00:00.5" Storyboard.TargetName="HoverBackground" Storyboard.TargetProperty="Opacity"/>
                                        <DoubleAnimation To="1" Duration="0:00:00.5" Storyboard.TargetName="PressedBackground" Storyboard.TargetProperty="Opacity"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Border Name="NormalBackground" CornerRadius="3" BorderBrush="Black" BorderThickness="1" Background="black" />
                        <Border Name="HoverBackground" Opacity="0" CornerRadius="3" BorderBrush="GreenYellow" BorderThickness="3" Background="Gray" />
                        <Border Name="PressedBackground" Opacity="0" CornerRadius="8" BorderBrush="Black" BorderThickness="1" Background="Red" />

                        <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" />
                    </Grid>

                </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

下面的代码演示了如何在MainPage.xaml上添加按钮

<Button x:Name="btnCall"    Click="btnCall_Click" Grid.Row="0" Grid.Column="1"  Content="test"   
Style="{StaticResource CustomButtonStyle}"   />  

Windows Phone实际上没有鼠标悬停

记住,在电话里,你没有鼠标。你想做什么(换句话说,你想在手机上模仿鼠标的效果是什么?)


[通常人们通过鼠标与仿真器进行交互,但当然手机本身没有相应的功能,因此支持它没有多大意义]

Windows phone并没有真正的鼠标控制功能

记住,在电话里,你没有鼠标。你想做什么(换句话说,你想在手机上模仿鼠标的效果是什么?)


[通常人们通过使用鼠标与仿真器进行交互,但当然手机本身没有相应的功能,因此支持它没有多大意义]

鼠标在未定义的区域移动光标,因此,它需要固定在地板上,以跟踪屏幕中根据创建的水平或垂直增量增加或减少的位置


触摸屏通常用于在已定义的区域中拾取和选择位置。你不会用移动鼠标“寻找”一个位置,你已经“知道”了。当你在屏幕上移动手指时,它是基于增量触发手势事件,而不是基于此增量移动光标。

鼠标在未定义的区域移动光标,因此,它需要固定在地板上,以跟踪屏幕中根据创建的水平或垂直增量增加或减少的位置

触摸屏通常用于在已定义的区域中拾取和选择位置。你不会用移动鼠标“寻找”一个位置,你已经“知道”了。当你在屏幕上移动手指时,它是基于一个增量触发手势事件,而不是基于这个增量移动光标