C# wpf的文本块工具提示问题

C# wpf的文本块工具提示问题,c#,wpf,tooltip,C#,Wpf,Tooltip,我有一个带有文本块的网格。我试图在TextBlock上显示工具提示(特别是在块的文本被CharacterEllipsis修剪时显示全文),但当我将鼠标悬停在TextBlock上时,工具提示不会显示。有什么想法吗 <DataTemplate x:Key="UnjoinedLampTemplate" DataType="{x:Type devices:DeviceViewModel}"> <Grid Width="133.2" Margi

我有一个带有文本块的网格。我试图在TextBlock上显示工具提示(特别是在块的文本被CharacterEllipsis修剪时显示全文),但当我将鼠标悬停在TextBlock上时,工具提示不会显示。有什么想法吗

<DataTemplate x:Key="UnjoinedLampTemplate" DataType="{x:Type devices:DeviceViewModel}">
        <Grid Width="133.2"
              Margin="0,10,0,10"
              Cursor="Hand"
              HorizontalAlignment="Center" VerticalAlignment="Top">
            <Grid.RowDefinitions>
                <RowDefinition Height="80" />
                <RowDefinition Height="25" />
            </Grid.RowDefinitions>
            <Border x:Name="DisplayColor" Grid.Row="0"
                    Width="70" Height="70"
                    CornerRadius="100"
                    Background="#54de61" />
            <Image Stretch="Uniform" Grid.Row="0"
                   Width="70" Height="70"
                   Source="path_to_component" />
            <Border x:Name="textDisplay" Grid.Row="0"
                    Visibility="Visible"
                    Background="Black" Opacity=".75"
                    BorderThickness="1" BorderBrush="White"
                    CornerRadius="5"
                    VerticalAlignment="Center" HorizontalAlignment="Center">
                <TextBlock Text="{Binding Label}" Style="{StaticResource DeviceLabelStyle}">
                    <TextBlock.ToolTip>
                        <ToolTip>
                                 <TextBlock Text="my tooltip" />
                        </ToolTip>
                    </TextBlock.ToolTip>
                </TextBlock>

            </Border>
        </Grid>
        <DataTemplate.Triggers>

以下是TextBlock中引用的DeviceLabelStyle:

   <Style x:Key="DeviceLabelStyle" TargetType="{x:Type TextBlock}">
        <Setter Property="FontSize" Value="14" />
        <Setter Property="FontFamily" Value="{StaticResource PrimaryFontFamily}" />
        <Setter Property="Margin" Value="5,3,5,3" />
        <Setter Property="Width" Value="100" />
        <Setter Property="Foreground" Value="White" />
        <Setter Property="TextAlignment" Value="Center" />
        <Setter Property="TextTrimming" Value="CharacterEllipsis" />
    </Style>


如果您将其应用于
文本显示
边框,它是否有效?它对我有效,没有任何问题。@Lucastrezesniewski Hm,当它应用于文本显示边框时,它仍然对我无效。你知道是什么原因导致这不起作用吗?我在这个应用程序的其他地方使用工具提示没有问题…@TSM我想这可能是因为
TextBlock
没有背景,需要将指针悬停在文本笔划上,这就是为什么我问它是否在边框上工作。您可以使用Snoop测试
ishitestvisible
的值,但我没有进一步的想法