locked
App crashes when an interaction behavior is defined within XAML

    Question

  • I have observed that my app crashes when an interaction behavior is defined within XAML.

    Can a flyout control have an interaction behavior?

    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>

    Code:

       

    publicclassFlyoutOpenedAction: DependencyObject, IAction


        {

           

    publicobjectExecute(objectsender, objectparameter)

            {

               

    varsearchBox = ResourceLocator.Instance[typeof(TextBox)] asTextBox;

                searchBox.Text =

    string.Empty;

               

    returnnull;

            }

        }

    Thursday, August 21, 2014 10:54 AM

Answers

  • Actually, I believe that flyouts cannot have behaviors. I will try to dig up the information I heard about this and update you when I find it.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, August 21, 2014 7:32 PM
    Moderator

All replies

  • Actually, I believe that flyouts cannot have behaviors. I will try to dig up the information I heard about this and update you when I find it.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, August 21, 2014 7:32 PM
    Moderator
  • Okay. Thanks.
    Friday, August 22, 2014 11:24 AM