2016-12-27 72 views
0

我在DevExpress gridview的內置搜索功能中遇到問題。我想找到項目0000-000,但沒有輸入中間的短劃線( - )。這個功能默認支持,還是我需要覆蓋他們的實現來提出我的解決方案?DevExpress GridView搜索

謝謝。節日快樂。

+0

我不能完全確定,以正則表達式添加到網格視圖search.There是在這裏討論,也許你檢查。使用正則表達式,你可以做到這一點 https://www.devexpress.com/Support/Center/Question/Details/T274353 – onur

回答

0

我不認爲你的任務可以通過設置一個選項來完成,它太具體了。如果您的目標是在鍵入「0000000」後獲取記錄,那麼也許您應該自定義KeyDown事件,手動停止搜索,更改增量搜索文本並再次手動繼續搜索。

例如

private void gridView_KeyUp(object sender, KeyEventArgs e) 
{ 
    if(gridView.GetIncrementalText().StartsWith("0000"))   
    { 
     gridView.StopIncrementalSearch(); 
     string txt = gridView.GetIncrementalText(); 
     txt = // use a RegexExpression or split the inserted text and add - in desired position 
     gridView.StartIncrementalSearch(txt); 
    } 
} 

還檢查了這個話題https://documentation.devexpress.com/#WindowsForms/CustomDocument114648