Windows phone 7 ListBoxItem中按钮的按下状态没有';t火

Windows phone 7 ListBoxItem中按钮的按下状态没有';t火,windows-phone-7,Windows Phone 7,我在列表框上有一个按钮。我在按钮上应用了样式。但是,它不会在按下的VisualState上启动。我确信这个样式没有问题,因为另一个按钮在另一个页面上使用了这个样式。有人能告诉我怎么解决这个问题吗。谢谢 以下是我在App.xaml页面上的风格: <Style x:Key="ButtonStyle1" TargetType="Button"> <Setter Property="Background" Value="Transparent"/>

我在列表框上有一个按钮。我在按钮上应用了样式。但是,它不会在按下的VisualState上启动。我确信这个样式没有问题,因为另一个按钮在另一个页面上使用了这个样式。有人能告诉我怎么解决这个问题吗。谢谢

以下是我在App.xaml页面上的风格:

 <Style x:Key="ButtonStyle1" TargetType="Button">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/>
        <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/>
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/>
        <Setter Property="Padding" Value="10,3,10,5"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid Background="Transparent">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneBackgroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="yellow"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneForegroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>

                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="ButtonBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
                                Background="{TemplateBinding Background}" CornerRadius="0" Margin="{StaticResource PhoneTouchTargetOverhang}">
                            <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" 
                                            Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" 
                                            HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                            Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

下面是我的control.xaml页面

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <ScrollViewer Style="{StaticResource ScrollViewerStyle1}" Background="#00E23162">
            <ListBox x:Name="lstCall" HorizontalAlignment="Left" Margin="6,6,0,0"   VerticalAlignment="Top" Width="400" SelectionChanged="lstCall_SelectionChanged"    >
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal" Height="65" Width="400">
                            <Image Source="{Binding Type}"  Width="35" Height="35"/>
                            <TextBlock  Width="240" Height="65" Text="{Binding summary}" TextWrapping="Wrap"
                                             Style="{StaticResource PhoneTextAccentStyle}"   />
                            <Button Width="135" Height="65" ClickMode="Press" Click="Action_Click" Style="{StaticResource ButtonStyle1}"
                                            Visibility="{Binding isVisibility, Converter={StaticResource VisibilityConverter}}">
                                <Button.Content>

                                    <TextBlock Width="85" Height="65" Text="{Binding ActionCaption}" 
                                                       Style="{StaticResource LabelStyle_20}"     />

                                </Button.Content>
                            </Button>
                        </StackPanel>                           

                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </ScrollViewer>
    </Grid>

系统很好。我没有看到颜色的变化,因为在点击事件中显示Meesage框