Listview Trouble - Tooltip Needed

对着背影说爱祢 提交于 2019-12-07 12:33:59

问题


I am building a WPF application in C# using VS2010

I have a listview that contains items from a database , and each item contains a field called (Name) and another field called (Time) .

Back in the database , each item has a third field called (Description) too ...

Now what I want is : When I choose an item from the listview , a tooltip is shown and it contains the data from the third field ..

How can I have various tooltips on one listview - one tooltip for each item - ?? How can I deal with my database ??

Thank You


回答1:


Setting the Tooltip for a ListViewItem can be done like this

<ListView ...>
    <ListView.ItemContainerStyle>
        <Style TargetType="{x:Type ListViewItem}">
            <Setter Property="ToolTip" Value="{Binding Path=Name}"/>
        </Style>
    </ListView.ItemContainerStyle>
    <!-- ... -->
</ListView>


来源:https://stackoverflow.com/questions/4184427/listview-trouble-tooltip-needed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!