[UE4] ToolTip does not work well
Posted: 08 Apr 2018, 15:11
The tooltip is flashing
The second not displayed on UE4, correct in WPF
Code: Select all
<ItemsControl x:Name="ItemsControlBuffList" ItemsSource="{Binding BuffList}"
Canvas.Left="550" Canvas.Top="475" Foreground="{x:Null}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Width="300" Height="50" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Border x:Name="BuffType" BorderBrush="#FF3EB6EE" Width="50" Height="50">
<Border.Triggers>
<DataTrigger Binding="{Binding bBuffFlag}" Value="True">
<Setter Property="Border.BorderBrush" Value="Red"></Setter>
</DataTrigger>
</Border.Triggers>
</Border>
<Button x:Name="BuffBtn" Width="45" Height="45" Command="{Binding DataContext.ShowBuffTips, ElementName=SpellPanelControl}"
CommandParameter="{Binding Description}">
<Button.Background>
<ImageBrush ImageSource="{Binding Icon}"></ImageBrush>
</Button.Background>
</Button>
<ToolTip x:Name="BuffDesc" IsHitTestVisible="False"
PlacementTarget="{Binding ElementName=BuffBtn}"
PlacementRectangle="0 -80 50 0"
BorderThickness="0" Visibility="{Binding ElementName=BuffBtn, Path=IsMouseOver, Converter={StaticResource BoolToVisible}}">
<Grid>
<TextBlock x:Name="BuffDescContent" Background="LightGray" Foreground="Black" Text="{Binding Description, FallbackValue=Windows_Presentation_Foundation }" FontFamily="{StaticResource Font_KaiTi}" FontSize="16" TextWrapping="Wrap" MinWidth="0" MaxWidth="300"></TextBlock>
</Grid>
</ToolTip>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>Code: Select all
<Grid Width="300" Height="100" Canvas.Left="500" Canvas.Top="100">
<Button x:Name="testBtn" Content="Hello WPF" FontSize="48" Margin="0" Background="#FF919191">
<Button.ToolTip>
<ToolTip x:Name="TestBuffDesc" IsHitTestVisible="False"
PlacementTarget="{Binding ElementName=testBtn}"
BorderThickness="0" Visibility="{Binding ElementName=testBtn, Path=IsMouseOver, Converter={StaticResource BoolToVisible}}">
<Grid>
<TextBlock x:Name="BuffDescContent" Background="Black" Foreground="White" Text="Hello WPF" FontFamily="{StaticResource Font_KaiTi}" FontSize="16" TextWrapping="Wrap" MinWidth="0" MaxWidth="300"></TextBlock>
</Grid>
</ToolTip>
</Button.ToolTip>
</Button>
</Grid>