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

 GridView - How to add a custom button to the FilterPanel

$
0
0

This example demonstrates how to add a button to the FilterPanel.




To use this solution in your application, execute the following steps:

1. Create a custom GridControl as it is shown at How to create a GridView descendant class and register it for design-time use.
2. Implement all required functionality in the CustomGridViewHandler, CustomGridView, CustomGridFilterPanelPainter classes.


Implementation details

In fact, the buttons are not located in the FilterPanel. They are simply drawn on its surface. Therefore, it is necessary to implement the Click (or MouseDown\Up) event manually and trigger it when required in your scenario. In this example, the Click event is raised when a custom button is clicked. If you need, for instance, to raise this event when the mouse button is released, you can simply update the CustomGridView.UpdateButtonState method. For instance, pass a parameter into this method which will indicate whether or not the CustomGridViewHandler.OnMouseUp event occurs. Then use this parameter in order to determine whether or not the Click event should be raised. 

It is also possible to change the distance between custom buttons, as well as their size. For this, update the CustomGridView.UpdateButtonsRects method as your needs dictate.

See also:
How to add a custom button to a column header in a grid 
GridControl - How to add a check box to a column header


Viewing all articles
Browse latest Browse all 7205

Trending Articles



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