ListItem鼠标输入消息框
问题描述:
我在我的XAML中使用了事件触发器,我在ListItem上设置了以下样式。我想要的是当鼠标进入列表项时,在消息框中显示ListItem的内容。ListItem鼠标输入消息框
<Style.Triggers>
<EventTrigger RoutedEvent="Mouse.MouseEnter">
</EventTrigger>
</Style.Triggers>
我想知道是否有可能在鼠标进入listitem后触发代码。
答
<ListBox>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<EventSetter Event="MouseEnter" Handler="_listBoxItem_MouseEnter"/>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
嗨肯特,谢谢你的帮助。但是,当我将发件人投到我的自定义对象[Person p = sender as Person];我在对象“p”中得到一个空值。 Person类有一个BitmapImage和一个String,用于保存图像的信息,并且此信息是我想要在消息框中显示的信息。任何指针? – 2009-04-09 14:00:41