locked
XAML Hub Control Windows 8.1 Universal, InvokeCommandAction not firing

    Question

  • I have a hub control on my main page and in the HubSection header i cant get the element to fire when i click on the button, however when i move the XAML into the DataTemplate the event if fired. Can you please explain to me why this is, do i need to enable something in the HubSection.Header so that the event can fire?

    here is the code that doesn't fire:

     <HubSection >
                    <HubSection.Header>
                        <StackPanel >
                            <TextBlock                            
                                Text="{Binding
                                    WhatToWatch.Name,
                                    Mode=OneWay}" />
                            <interactivity:Interaction.Behaviors>
                                <core:EventTriggerBehavior EventName="Tapped">
                                    <core:InvokeCommandAction
                                        Command="{Binding ViewMoreCommand}"
                                        CommandParameter="{Binding WhatToWatch.Name}" />
                                </core:EventTriggerBehavior>
                            </interactivity:Interaction.Behaviors>
                        </StackPanel>
                    </HubSection.Header>
                    <DataTemplate>
                        <controls:RowGridView
                            ItemsSource="{Binding
                                WhatToWatch.Data,
                                Mode=TwoWay}" />
                    </DataTemplate>
                </HubSection>

    And here is the code that does fire the Event:

                    <DataTemplate>
                        <StackPanel    > 
                            <StackPanel >
                                <interactivity:Interaction.Behaviors>
                                    <core:EventTriggerBehavior EventName="Tapped">
                                        <core:InvokeCommandAction Command="{Binding ViewMoreCommand}" />
                                    </core:EventTriggerBehavior>
                                </interactivity:Interaction.Behaviors>
                                <TextBlock 
                                    Text="{Binding
                                        WhatToWatch.Name,
                                        Mode=OneWay}" />
                            </StackPanel>
                            <controls:RowGridView 
                                ItemsSource="{Binding
                                    WhatToWatch.Data,
                                    Mode=TwoWay}" />
                        </StackPanel>
                    </DataTemplate>
                </HubSection>

    Its the same code, but in the second one the core:InvokeCommandAction action is in the DataTemplate, is this what allows the XAML to call the event? why is this so?


    Damien Delaire

    Friday, November 14, 2014 6:10 AM

All replies

  • A similar behaviour triggers for me in a Hub's Header. Do you have any other controls that might be covering the header and blocking the tap from getting through?

    Can you share a minimal sample which demonstrates the problem?

    Saturday, November 15, 2014 2:24 AM
    Owner
  • Have you set IsHeaderInteractive=True on the HubSection?

    Darin R.

    Saturday, November 15, 2014 5:40 PM