Mouayad
Mouayad

Reputation: 255

Listview Trouble - Tooltip Needed

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

Upvotes: 3

Views: 1373

Answers (1)

Fredrik Hedblad
Fredrik Hedblad

Reputation: 84647

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>

Upvotes: 6

Related Questions