Wpf 绑定到字符串列表时ListBoxItem的工具提示
当ListBox控件绑定到字符串列表时,如何显示ListBoxItem的工具提示。下面是我的ListBox的源代码,其中ConcernedConditions为列表类型Wpf 绑定到字符串列表时ListBoxItem的工具提示,wpf,mvvm,listbox,tooltip,Wpf,Mvvm,Listbox,Tooltip,当ListBox控件绑定到字符串列表时,如何显示ListBoxItem的工具提示。下面是我的ListBox的源代码,其中ConcernedConditions为列表类型 <ListBox ItemsSource="{Binding ConcernedConditions}" Style="{StaticResource CustomStyle}"> <ListBox.ItemContainerStyle> <Style TargetType=
<ListBox ItemsSource="{Binding ConcernedConditions}" Style="{StaticResource CustomStyle}">
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<ContentPresenter />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
您能否设置listbox的项目模板的样式并在其中放置一个textblock,然后使用它的tooltip属性
<ListBox ItemsSource="{Binding Strings}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" ToolTip="Here is a tooltip"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
您能否设置listbox的项目模板的样式并在其中放置一个textblock,然后使用它的tooltip属性
<ListBox ItemsSource="{Binding Strings}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" ToolTip="Here is a tooltip"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
哇!这真是一个容易解决的问题。谢谢安迪:哇。。。这真是一个容易解决的问题。谢谢安迪: