Atif Khan
Atif Khan

Reputation: 321

How to remove "tap" event from “Group Header” and manually call the “Jump List” in “Long List Selector”?

I am using Long List Selector in my app, I have made groups and group headers in it. Now, I am adding a button in the group header and want the button to open new page. But, when I click on the button it navigates to new page as well as opens the "Jump List". I don't want the jump list when I click the button. I have found this link, but, here is no clear answer.

Is there any way to disable the "tap" event on "group header" and call when needed?

My code is:

xaml:

 <DataTemplate x:Key="groupHeaderTemplate">
        <Border HorizontalAlignment="Stretch" Height="70"  Background="{Binding Converter={StaticResource BackgroundConverter}}" Margin="6">
            <Grid HorizontalAlignment="Stretch" Background="Transparent">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>

                <TextBlock Text="{Binding Title}"
                       FontSize="40" Padding="6"
                       VerticalAlignment="Center" 
                       Foreground="{Binding Converter={StaticResource ForegroundConverter}}" />
                <Button Content="addNew" Name="addNew_btn" Grid.Column="1"   Click="addNew_btn_Click_1" Tag="{Binding transType}" />

            </Grid>

        </Border>
    </DataTemplate>

CS:

private void addNew_btn_Click_1(object sender, RoutedEventArgs e)
    {

        NavigationService.Navigate(new Uri("/Expense.xaml", UriKind.Relative));

    }

Upvotes: 2

Views: 813

Answers (1)

Benoit Catherinet
Benoit Catherinet

Reputation: 3345

If I understand right, you want to open the jump list when you tap outside the button and open another page when you tap on a button. To do that you can just register for the Tap event instead of click on the button and inside the Tap event handler set e.Handled = true; that will prevent the event to bubble and the the Jump list to open when pressing the button.

Upvotes: 5

Related Questions