Talent オブジェクトの ObservableCollection を表示する ListBox があります。ユーザーが ListBox の各項目にカーソルを合わせたときに、Talent に関するいくつかの情報を ToolTip に表示したいと考えています。
私のリストボックス:
<ListBox ItemsSource="{Binding ElementName=CE_Races_racesLB, Path=SelectedItem.Talents}" ItemTemplate="{StaticResource removableTalentListTemplate}" />
アイテム テンプレート:
<DataTemplate x:Key="removableTalentListTemplate">
<StackPanel>
<TextBlock FontSize="13" Text="{Binding Path=tName}" VerticalAlignment="Center" Width="175" Height="18" Grid.Column="0" />
</StackPanel>
</DataTemplate>
ToolTipService.ToolTip="{Binding Path=Description" を TextBlock プロパティに追加すると、Talent の説明を表示できます。ただし、次のようなカスタム ツールチップを作成しようとすると:
<DataTemplate x:Key="removableTalentListTemplate">
<StackPanel>
<TextBlock FontSize="13" Text="{Binding Path=tName}" VerticalAlignment="Center" Width="175" Height="18" Grid.Column="0" />
<TextBlock.ToolTip>
<ToolTip>
<StackPanel>
<TextBlock Text="{Binding Path=Description}" />
</StackPanel>
</ToolTip>
</TextBlock.ToolTip>
</TextBlock>
</StackPanel>
</DataTemplate>
ListBox 項目にマウスオーバーすると、ツールチップに "System.Windows.Controls.StackPanel" とだけ表示されます。多くの情報を表示する素敵なツールチップを作成したいのですが、この障害を乗り越えることができません。これが現在のスクリーンショットです: http://silkforge.com/dev/ss.jpg . マウスは見えませんが、ListBox アイテム「Acute Hearing I」のすぐ下にツールチップが表示されます。