C# UWP-在xaml中的图像上创建数据绑定工具提示
我有一个数据驱动的集线器部分,可以很好地填充图像。视图模型包含我想显示为工具提示的文本,但无法完全理解 以下是重要的片段:C# UWP-在xaml中的图像上创建数据绑定工具提示,c#,xaml,tooltip,win-universal-app,C#,Xaml,Tooltip,Win Universal App,我有一个数据驱动的集线器部分,可以很好地填充图像。视图模型包含我想显示为工具提示的文本,但无法完全理解 以下是重要的片段: <HubSection x:Uid="MyHub" x:Name="MyHubSection" Width="311"> <HubSection.Header> <TextBlock x:Uid="HubMSectionHeader" Style="{StaticResource MainH
<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>
我想知道为什么工具提示服务代码不在图像控件内。您可以试试图像控件内的代码,告诉我它是否有效吗? 修改后的代码将被删除
<Image Source="{Binding ProfilePhotoBitmap, Mode=TwoWay}" Height="100" Opacity="1" Stretch="Uniform" Tapped="Friend_Tapped">
<ToolTipService.ToolTip>
<TextBlock Text="{Binding FullName}"/>
</ToolTipService.ToolTip>
</Image>
噢,我都没注意到+1谢谢。就这样!