我正在使用Telerik WinForms RadGridView控件,我已经设置了类似Excel的过滤,一切都很好,但我有一点问题。当我过滤一个布尔字段时,在过滤器弹出窗口中,它们是值:“True”和“False”。是否可以在更加用户友好的方面更改它们,例如“是”和“否”?
答案 0 :(得分: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";
}
}