I'm trying to implement a tool-tip system in a WPF MVVM application. The tool-tip is supposed to appear in a certain Label that is a part of the MainWindow (not hovering at the mouse pointer) and should happen on mouse-over (ideally with a configurable delay, but that is unimportant), calling a method in the appropriate ViewModel. The ViewModel will then deal with contacting the Model layer that will resolve which tool-tip to display etc.
My problem is how to get a mouse-over event from the view to the ViewModel, along with the identity of the object that fired the event (so I can resolve the right tool-tip for it). Let's say I have a <Label Name="MyLabel" Content="This is a label" />
in my SettingsView.xaml, how do I get it to call the GetTooltip(string id)
method in SettingsViewModel with MyLabel as the argument (or otherwise accessible) on mouse-over? Can I use a regular <Trigger>
to do it somehow?