当在XAML中定义交互行为时,应用程序崩溃

当在XAML中定义交互行为时,应用程序崩溃,xaml,winrt-xaml,windows-8.1,windows-phone-8.1,expression-blend,Xaml,Winrt Xaml,Windows 8.1,Windows Phone 8.1,Expression Blend,我观察到,当在XAML中定义交互行为时,我的应用程序崩溃 弹出控件能否具有交互行为 XAML: <AppBarButton Icon="Find" Label="Find"> <Button.Flyout> <Flyout x:Name="SearchFlyout"> <Interactivity:Interaction.Behaviors> <Core:Eve

我观察到,当在XAML中定义交互行为时,我的应用程序崩溃

弹出控件能否具有交互行为

XAML:

<AppBarButton Icon="Find" Label="Find">
    <Button.Flyout>
        <Flyout x:Name="SearchFlyout">

            <Interactivity:Interaction.Behaviors>
                <Core:EventTriggerBehavior EventName="Opened">
                    <behaviors:FlyoutOpenedAction />
                </Core:EventTriggerBehavior>
            </Interactivity:Interaction.Behaviors>

            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                <TextBox x:Name="Searchbox" PlaceholderText="contact's name" Width="250" 
                         IsTextPredictionEnabled="False"
                         IsSpellCheckEnabled="False"
                         VerticalAlignment="Center">

                    <Interactivity:Interaction.Behaviors>
                        <Core:EventTriggerBehavior EventName="KeyUp">
                            <behaviors:FilterContactAction />
                        </Core:EventTriggerBehavior>
                    </Interactivity:Interaction.Behaviors>
                </TextBox>
            </StackPanel>
        </Flyout>
    </Button.Flyout>
</AppBarButton>
public class FlyoutOpenedAction : DependencyObject, IAction
{
    public object Execute(object sender, object parameter)
    {
        var searchBox = ResourceLocator.Instance[typeof(TextBox)] as TextBox;
        searchBox.Text = string.Empty;

        return null;
    }
}