2016-05-03 26 views
2

私はデータ駆動型のハブセクションを持っています。ビューモデルには、ツールチップとして表示したいテキストが含まれていますが、それを理解できません。ここでUWP - xamlの画像上にデータバインドされたツールチップを作成する

が重要な抜粋です:

<HubSection x:Uid="MyHub" x:Name="MyHubSection" Width="311"> 
    <HubSection.Header> 
     <TextBlock x:Uid="HubMSectionHeader" 
       Style="{StaticResource MainHubSectionHeaderStyle}" Text="Friends"/> 
    </HubSection.Header> 
    <DataTemplate> 
     <StackPanel> 
     <Button x:Name="InviteButton" Content="Send Invite" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Click="InviteButton_Click"/> 
     <StackPanel > 
      <Grid> 
       <GridView ItemsSource="{Binding Friends}" Background="{ThemeResource HubBackground}" x:Name="FriendGrid" > 
        <GridView.ItemTemplate > 
         <DataTemplate> 
          <Image Source="{Binding ProfilePhotoBitmap, Mode=TwoWay}" Height="100" Opacity="1" Stretch="Uniform" Tapped="Friend_Tapped"/> 
          <ToolTipService.ToolTip> 
           <TextBlock Text="{Binding FullName}"/> 
          </ToolTipService.ToolTip> 
         </DataTemplate> 
        </GridView.ItemTemplate> 
        </GridView> 
       </Grid> 
      </StackPanel> 
     </StackPanel> 
     </DataTemplate> 
    </HubSection> 

答えて

5

ツールチップのサービスコードは、イメージコントロールの外にあるなぜ私が疑問に思って、あなたは、イメージコントロール内に試みることができると私はそれが動作するかどうかを知らせますか? 変更されたコードスニペットは

<Image Source="{Binding ProfilePhotoBitmap, Mode=TwoWay}" Height="100" Opacity="1" Stretch="Uniform" Tapped="Friend_Tapped"> 
      <ToolTipService.ToolTip> 
       <TextBlock Text="{Binding FullName}"/> 
      </ToolTipService.ToolTip> 
      </Image> 
+0

です。 +1 –

+0

ありがとうございます。それだった! –

+0

:)ハッピーコーディング –

関連する問題