How to Check Infragistic UltraGrid is in Filter Mode

Suppose we have a need to check whether our UltraGrid is in Filtration mode or not. If yes, then disable some functionality or display some warning message etc. To do so, we need to add an event hander ‘AfterRowFilterChanged’ on UltraGrid. In this example, I am checking that whether filter is applied on any column in Band-2.

Code
  1. private void ultraGrid1_AfterRowFilterChanged(object sender, Infragistics.Win.UltraWinGrid.AfterRowFilterChangedEventArgs e)    
  2. {    
  3.     bool bAreEventsInFilteredMode = false;    
  4.     
  5.     foreach (UltraGridColumn column in ultraGrid1.DisplayLayout.Bands[2].Columns)    
  6.     {    
  7.         if (ultraGrid1.DisplayLayout.Bands[2].ColumnFilters[column].FilterConditions.Count > 0)    
  8.         {    
  9.             bAreEventsInFilteredMode = true;    
  10.             break;    
  11.         }    
  12.     }    
  13.     
  14.     if(bAreEventsInFilteredMode)    
  15.     {    
  16.         MessageBox.Show("Grid is in Filter Mode!""Warning", MessageBoxButtons.OK,MessageBoxIcon.Warning);    
  17.     }    
  18. }