bool SampleFilter(IObservableList <TreeNode <TreeViewItem> > nodes, Func <TreeViewItem, bool> filterFunc) { return(nodes.Count(x => { var have_visible_children = (x.Nodes == null) ? false : SampleFilter(x.Nodes, filterFunc); x.IsVisible = have_visible_children || filterFunc(x.Item); return x.IsVisible; }) > 0); }
public static IObservable <bool> IsNonEmpty <T>(this IObservableList <T> self) { return(self.Count().Select(c => c > 0).DistinctUntilChanged()); }
bool SampleFilter(IObservableList<TreeNode<TreeViewItem>> nodes, Func<TreeViewItem,bool> filterFunc) { return nodes.Count(x => { var have_visible_children = (x.Nodes==null) ? false : SampleFilter(x.Nodes, filterFunc); x.IsVisible = have_visible_children || filterFunc(x.Item) ; return x.IsVisible; }) > 0; }