Please refer to the following code snippet demonstrating how the comparer can be applied:
public RadForm1()
{
InitializeComponent();
this.radGridView1.EnableFiltering = true;
this.radGridView1.ShowHeaderCellButtons = true;
this.radGridView1.FilterPopupInitialized += radGridView1_FilterPopupInitialized;
}
private void radGridView1_FilterPopupRequired(object sender, FilterPopupRequiredEventArgs e)
{
RadListFilterPopup popup = e.FilterPopup as RadListFilterPopup;
if (popup != null)
{
popup.MenuTreeElement.TreeView.TreeViewElement.Comparer = new MyComparer(popup.MenuTreeElement.TreeView.TreeViewElement);
}
}
class MyComparer : TreeNodeComparer
{
public MyComparer(RadTreeViewElement treeView)
: base(treeView)
{
}
public override int Compare(RadTreeNode x, RadTreeNode y)
{
if (this.TreeViewElement.SortOrder == SortOrder.Descending)
{
return x.Text.CompareTo(y.Text);
}
return x.Text.CompareTo(y.Text) * -1;
}
}