I have overridden the draw event of a list view to draw my own individual tiles. On each tile I want to place an icon of a phone and attach a click event to it so a user can click on the little icon (within a tiled listview item) and it executes a command.
I'd also like to implement a hover type scenario where I can change icon colours or text colour when the mouse hovers over an icon.
Does anyone know if this is possible?
I am using the ObjectListView in tile view if that makes any difference.
I guess you are using
ObjectListView's
ItemRenderer
to custom draw the tiles.Each renderer has a
HitTest()
method. In your renderer, override this method and when the given point is over something interesting, change theOlvListViewHitTestInfo.HitTestLocation
to beUserDefined
andOlvListViewHitTestInfo.UserData
to be whatever you want (e.g. "phone").ObjectListView.MouseMoveHitTest
holds the hit test information from the last mouse move.Setup a
MouseUp
event handler, and in that handler, look atMouseMoveHitTest.HitTestLocation
andMouseMoveHitTest.UserData
properties to see if the mouse was over your phone when it was clicked.Similarly, when you are drawing your tile, you can use those same properties to decide whether to draw the phone highlighted or not.