Note that there are some explanatory texts on larger screens.

plurals
  1. POCustom tooltip for listbox item in WPF
    primarykey
    data
    text
    <p>I've got a ListBox that displays an ObservableCollection of Talent objects. When the user hovers over each item in the ListBox, I'd like to display in the ToolTip several pieces of information about the Talent.</p> <p>My ListBox:</p> <pre><code>&lt;ListBox ItemsSource="{Binding ElementName=CE_Races_racesLB, Path=SelectedItem.Talents}" ItemTemplate="{StaticResource removableTalentListTemplate}" /&gt; </code></pre> <p>The ItemTemplate:</p> <pre><code>&lt;DataTemplate x:Key="removableTalentListTemplate"&gt; &lt;StackPanel&gt; &lt;TextBlock FontSize="13" Text="{Binding Path=tName}" VerticalAlignment="Center" Width="175" Height="18" Grid.Column="0" /&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; </code></pre> <p>I can display the Description of the Talent if I add ToolTipService.ToolTip="{Binding Path=Description" to the TextBlock properties. However, when I try to create a custom ToolTip like such:</p> <pre><code>&lt;DataTemplate x:Key="removableTalentListTemplate"&gt; &lt;StackPanel&gt; &lt;TextBlock FontSize="13" Text="{Binding Path=tName}" VerticalAlignment="Center" Width="175" Height="18" Grid.Column="0" /&gt; &lt;TextBlock.ToolTip&gt; &lt;ToolTip&gt; &lt;StackPanel&gt; &lt;TextBlock Text="{Binding Path=Description}" /&gt; &lt;/StackPanel&gt; &lt;/ToolTip&gt; &lt;/TextBlock.ToolTip&gt; &lt;/TextBlock&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; </code></pre> <p>When I go to mouseover the ListBox item, the tooltip just says "System.Windows.Controls.StackPanel". I'd really like to create a nice ToolTip showing lots of info but I can't get past this roadblock. Here's a screenshot of what it looks like now: <a href="http://silkforge.com/dev/ss.jpg" rel="nofollow">http://silkforge.com/dev/ss.jpg</a>. You can't see the mouse, but you can see the tooltip just under the ListBox item "Acute Hearing I".</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload