Ad

ListItem Mouse Enter Message Box

- 1 answer

I am using event triggers in my XAML, I have the following style set on a ListItem. What I want is to display the contents of the ListItem in a message box when the mouse enters a list item.

        <Style.Triggers>
            <EventTrigger RoutedEvent="Mouse.MouseEnter">

            </EventTrigger>
        </Style.Triggers>

I am wondering if its possible to fire code behind when the mouse enters the listitem.

Ad

Answer

<ListBox>
    <ListBox.ItemContainerStyle>
        <Style TargetType="ListBoxItem">
            <EventSetter Event="MouseEnter" Handler="_listBoxItem_MouseEnter"/>
        </Style>
    </ListBox.ItemContainerStyle>
</ListBox>
Ad
source: stackoverflow.com
Ad