public TreeViewViewModel(TreeViewItemViewModel treeViewItemViewModelViewModel, Func <string, IObservable <IList <Predicate <object> > > > searchFunc = null) { _searchFunc = searchFunc; ClearSearchCommand = new DelegateCommand(ClearSearch, CanSearch); _treeViewItemViewModel = treeViewItemViewModelViewModel; this.ToObservable(x => x.SearchText) .Throttle(TimeSpan.FromMilliseconds(1000), DispatcherScheduler.Current) .Where(_ => CanSearch()) .Subscribe(_ => Search()); }
public TreeViewItemViewModel(TreeViewItemViewModel parent, object value, Func <object, IEnumerable <LoaderResult> > lazyLoader, Func <TreeViewItemViewModel, object, Func <object, IEnumerable <LoaderResult> >, TreeViewItemViewModel> itemFactory) { Parent = parent; Value = value; _lazyLoader = lazyLoader; _itemFactory = itemFactory; _items = new ObservableCollection <TreeViewItemViewModel>(); if (lazyLoader != null) { _items.Add(DummyItem); } }
private TreeViewItemViewModel InitialiseItem(TreeViewItemViewModel item) { if (IsChecked.HasValue) { item._isChecked = IsChecked; } if (IsVisible.HasValue) { item._isVisible = IsVisible; } item.Parent = this; return(item); }
private void UpdateVisibleSiblingsAndParent(TreeViewItemViewModel child) { UpdateSiblingsAndParent(child, x => x._isVisible, (x, y) => x._isVisible = y, _isVisible, x => x.OnPropertyChanged(() => IsVisible), x => { }); }
private void UpdateCheckedSiblingsAndParent(TreeViewItemViewModel sender, TreeViewItemViewModel child) { UpdateSiblingsAndParent(child, x => x._isChecked, (x, y) => x._isChecked = y, _isChecked, x => x.OnPropertyChanged(() => IsChecked), x => x.RaiseCheckedChanged(sender)); }