Search code examples
windows-phone-8windows-phonetouchgesture

Adding image to title of Pivot page and handling touch


I am trying to add image next to pivot control title and I want to be able to touch it. But I can't and I guess it's because pivot is handling touches. This is my code:

    <Grid Margin="162,22,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"
          Tap="MessagesIcon_OnTap">
          <Image Source="/Assets/Images/Icons/messages_icon.png" 
                 x:Name="MessagesIcon"
                 Stretch="Fill" Opacity="1" Width="20" Height="22"
                 Tap="MessagesIcon_OnTap"/>
    </Grid>
    <phone:Pivot x:Name="PlayerPivot" Title="TITLE" >
        <!--Pivot item one-->
        <phone:PivotItem Margin="0" x:Name="PlayingPivotItem">
            <phone:PivotItem.Header>
                <TextBlock Text="subtitle" />
            </phone:PivotItem.Header>
            <Grid x:Name="ContentPanel">
                     ...

As you can see I tried catch tap on both (grid which contains image and image it self) but it isn't call. What is the easiest way to get tap gesture on image? Thanks


Solution

  • Give a try using this snippet:

    <controls:Pivot.Title>  
    <StackPanel>                   
    <TextBlock Text="title" />     
    <Image Source="/Images/anyimage.png"/>              
    </StackPanel>           
    </controls:Pivot.Title>