void filterList(string searchfor) { if (searchfor.Length >= 2 || searchfor.Length == 0) { var expanded = Params.ExpandedObjects.OfType <object>().Where((o, i) => { var count = Params.VirtualListDataSource.GetObjectCount(); for (int a = 0; a < count; a++) { var obj = Params.VirtualListDataSource.GetNthObject(a); if (obj == o) { return(true); } } return(false); }).ToArray(); Params.Visible = false; Params.UseFiltering = false; Params.ExpandAll(); Params.ModelFilter = TextMatchFilter.Regex(Params, searchfor.Replace("*", ".*").Replace("..*", ".*").ToLower()); Params.DefaultRenderer = new HighlightTextRenderer((TextMatchFilter)Params.ModelFilter); Params.UseFiltering = true; if (Params.Items.Count > 0) { if (searchfor.Length == 0) { Params.CollapseAll(); } foreach (var row in expanded) { Params.Expand(row); } } Params.Visible = true; } if (chk_modified.Checked) { var filter = String.Format("({0})", String.Join("|", _changes.Keys.Select(a => a.ToString()))); Params.ModelFilter = TextMatchFilter.Regex(Params, filter); Params.DefaultRenderer = new HighlightTextRenderer((TextMatchFilter)Params.ModelFilter); Params.UseFiltering = true; } }
void filterList(string searchfor) { if (searchfor.Length >= 2 || searchfor.Length == 0) { var expanded = Params.ExpandedObjects.OfType <object>().Where((o, i) => { var count = Params.VirtualListDataSource.GetObjectCount(); for (int a = 0; a < count; a++) { var obj = Params.VirtualListDataSource.GetNthObject(a); if (obj == o) { return(true); } } return(false); }).ToArray(); Params.Visible = false; Params.UseFiltering = false; Params.ExpandAll(); Params.ModelFilter = TextMatchFilter.Regex(Params, searchfor.ToLower()); Params.DefaultRenderer = new HighlightTextRenderer((TextMatchFilter)Params.ModelFilter); Params.UseFiltering = true; if (Params.Items.Count > 0) { if (searchfor.Length == 0) { Params.CollapseAll(); } foreach (var row in expanded) { Params.Expand(row); } } Params.Visible = true; } }