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());
        }
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
        private TreeViewItemViewModel InitialiseItem(TreeViewItemViewModel item)
        {
            if (IsChecked.HasValue)
            {
                item._isChecked = IsChecked;
            }

            if (IsVisible.HasValue)
            {
                item._isVisible = IsVisible;
            }

            item.Parent = this;

            return(item);
        }
Beispiel #4
0
 private void UpdateVisibleSiblingsAndParent(TreeViewItemViewModel child)
 {
     UpdateSiblingsAndParent(child, x => x._isVisible, (x, y) => x._isVisible = y, _isVisible, x => x.OnPropertyChanged(() => IsVisible), x => { });
 }
Beispiel #5
0
 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));
 }