2012-04-02 91 views
0

我正在使用Telerik WinForms RadGridView控件,我已經設置了類似Excel的過濾,一切都很好,但我有一個小問題。當我篩選布爾字段時,在篩選器彈出它們的值是:「True」和「False」。是否有可能通過更方便用戶的方式來改變它們,如「是」和「否」?Telerik WinForms Radgriview過濾器布爾

回答

0

從Telerik的人幫我解決這個問題:)

http://www.telerik.com/community/forums/winforms/gridview/winforms-radgriview-filter-boolean.aspx

爲了避免鏈接只能回答這是不是在理想的情況下鏈接中斷。以下是解決問題的相關代碼:

void radGridView1_FilterPopupRequired(object sender, FilterPopupRequiredEventArgs e) 
{ 
    RadListFilterPopup popup = e.FilterPopup as RadListFilterPopup; 
    if (popup != null) 
    { 
     RadTreeView tree = popup.MenuTreeElement.TreeView; 
     tree.NodeAdded += new RadTreeView.RadTreeViewEventHandler(tree_NodeAdded); 
     popup.PopupClosed += new RadPopupClosedEventHandler(popup_PopupClosed); 
    } 
} 

void popup_PopupClosed(object sender, RadPopupClosedEventArgs args) 
{ 
    RadListFilterPopup popup = sender as RadListFilterPopup; 
    popup.MenuTreeElement.TreeView.NodeAdded -= new RadTreeView.RadTreeViewEventHandler(tree_NodeAdded); 
} 

void tree_NodeAdded(object sender, RadTreeViewEventArgs e) 
{ 
    if (e.Node.Text == "False") 
    { 
     e.Node.Text = "No"; 
    } 
    else if (e.Node.Text == "True") 
    { 
     e.Node.Text = "Yes"; 
    } 
}