Silverlight Windows Phone事件触发器不工作

Silverlight Windows Phone事件触发器不工作,silverlight,windows-phone-8,storyboard,eventtrigger,Silverlight,Windows Phone 8,Storyboard,Eventtrigger,我有一个用于填充longlistselector的DataTemplate。此数据模板中有2行。第1行包含一个按钮,按下时应滑开第2行。问题是,当我运行应用程序时,我得到一个未处理的异常 以下是数据模板: <DataTemplate> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefi

我有一个用于填充longlistselector的DataTemplate。此数据模板中有2行。第1行包含一个按钮,按下时应滑开第2行。问题是,当我运行应用程序时,我得到一个未处理的异常

以下是数据模板:

<DataTemplate>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>     

        <!-- 1st ROW -->
        <Border Background="Red" HorizontalAlignment="Stretch">                            
            <Grid>                                
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>                            
                <TextBlock Text="Test Item" FontSize="42" />
                <Button Content="v" Grid.Column="1">
                    <Button.Triggers>                                        
                        <EventTrigger RoutedEvent="Button.Tap">                                            
                            <BeginStoryboard>                                                
                                <Storyboard x:Name="myBoard" TargetProperty="Border.Height" TargetName="Slider">
                                    <DoubleAnimation From="0" To="60" Duration="0:0:2" />
                                </Storyboard>                                                
                            </BeginStoryboard>                                            
                        </EventTrigger>
                    </Button.Triggers>
                </Button>
            </Grid>
        </Border>

        <!-- 2nd ROW -->
        <Border x:Name="Slider" Grid.Row="1" Background="Green" HorizontalAlignment="Stretch" Height="0">
            <TextBlock Text="Slider" FontSize="42" />
        </Border>

    </Grid>    
</DataTemplate>

/编辑:

当我在网格的已加载事件上使用触发器时,它确实起作用。Silverlight似乎只支持RouteEvent属性的已加载事件。如下所述:

尽管使用按钮的已加载事件也不起作用。

我找到了一个解决方案:

<Button Content="v" Grid.Column="1">
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Tap">
            <eim:ControlStoryboardAction ControlStoryboardOption="Play">
                <eim:ControlStoryboardAction.Storyboard>
                    <Storyboard TargetProperty="(Border.Height)" TargetName="Slider">
                        <DoubleAnimation From="0" To="60" Duration="0:0:2" />
                    </Storyboard>
                </eim:ControlStoryboardAction.Storyboard>
            </eim:ControlStoryboardAction>
        </i:EventTrigger>
    </i:Interaction.Triggers>                                    
</Button>

显然,您可以在ControlStoryboardAction中定义情节提要,这正是我所需要的