Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

RibbonControl - How to show a hint on hovering the mouse over the BarItem's glyph and execute a certain action when the glyph is clicked

$
0
0

This example demonstrates a possible way of implementing the "Add to Favorites" functionality.

Possible scenario

We are developing a chat application using DevExpress RibbonControl. Like in the majority of such applications, we have a list of  "Favorite" contacts. So, we would like to have the capability to click on the contact's glyph to add a contact to the list or remove this contact from the list if the list already contains it.


Steps to implement


1. Implement the IMessageFilter interface to catch mouse move messages in order to show a tool tip after some time interval has elapsed. 

2. Implement some functionality which will allow us to know whether or not Cursor is above the the contact's glyph and also to correctly determine a tool tip location. In this example, an approach described in the BarButtonItem: handling click on image ticket is used for this purpose.

3. 
Handle the ItemClick event for all bar items in the contacts list and design a method (methods) which will add the clicked item to the "Favorites" list if Cursor is above the bar item's glyph or remove the item if the "Favorites" list already contains it.




Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>