2015-08-30 44 views
0

我有一個devexpress gridcontrol與查找選項。 我想在FindControl的搜索啓動時捕獲事件,以強制顯示。趕上findcontrol搜索的事件

我發現這個功能,但它只能在LostFocus事件:

private void gridView1_LostFocus(object sender, EventArgs e) 
    { 
     System.Reflection.PropertyInfo pFindPanel = gridView1.GetType().GetProperty("FindPanel", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); 
     FindControl findPanel = (FindControl)pFindPanel.GetValue(gridView1, null); 

     Point pt = gridControl1.PointToClient(MousePosition); 
     if ((!findPanel.Bounds.Contains(pt))) 
     { 
      MessageBox.Show("Do!"); 
     } 
    } 

我沒有找到這個問題的解決方案!謝謝你們的幫助。

回答

0

您可以使用ColumnView.ColumnFilterChanged事件。在這種情況下,您可以檢查ColumnView.FindFilterText屬性的值並在表單中顯示此值。
這裏是例子:

private void gridView1_ColumnFilterChanged(object sender, EventArgs e) 
{ 
    string findFilter = gridView1.FindFilterText; 

    if (!string.IsNullOrEmpty(findFilter)) 
     MessageBox.Show(findFilter); 
}