private void RefreshTableCollectionView()
        {
            ICollectionView collectionView = new CollectionViewSource {
                Source = App.tableViewModel.Items
            }.View;

            collectionView.Refresh();

            lbTableList.ItemsSource = collectionView;
        }
Example #2
0
 private void Module_DataLoaded(object sender, EventArgs e)
 {
     logger.Trace("DataLoaded()...");
     RaisePropertyChanged("Events");
     RaisePropertyChanged("DiaryStartTime");
     RaisePropertyChanged("DiaryEndtime");
     Events = new CollectionViewSource {
         Source = _module.ScanTasks
     }.View;
     Events.Filter = new Predicate <object>(o => FilterTask(o));
     Events.Refresh();
 }
Example #3
0
        public void RefreshEmitsCurrentChangingEvents()
        {
            var events = new List <CurrentChangingEventArgs>();
            var data   = new List <object> {
                "First",
                "Second",
                "Third",
                "Fourth",
                "Fifth",
            };

            var view = new CollectionViewSource()
            {
                Source = data
            }.View;

            view.CurrentChanging += (o, e) => events.Add(e);

            view.Refresh();
            Assert.AreEqual(1, events.Count, "#1");

            view.Refresh();
            Assert.AreEqual(2, events.Count, "#2");
        }
 public AccountsListViewModel()
 {
     App.DB.Accounts.Load();
     Accounts = new CollectionViewSource {
         Source = App.DB.Accounts.Local
     }.View;
     AddAccountCommand = new DelegateCommand <RoutedEventArgs>((e) => {
         var newaw = new NewAccount();
         newaw.ShowDialog();
     }, () => true);
     DeleteAccountCommand = new DelegateCommand <Account>((account) =>
     {
         if (account != null)
         {
             App.DB.Accounts.Remove(account);
             App.DB.SaveChanges();
             Accounts.Refresh();
         }
     }, () => true);
 }
Example #5
0
        public MainAndFilterPage()
        {
            InitializeComponent();
            var allStationsView = new CollectionViewSource {
                Source = Stations.GetAll()
            }.View;

            allStationsView.Filter  = x => Filter(filter.Text, fromStation, excludeStation, (Station)x);
            allStations.ItemsSource = allStationsView;
            Observable.FromEvent <TextChangedEventArgs>(filter, "TextChanged")
            .Throttle(TimeSpan.FromMilliseconds(300))
            .Subscribe(_ => Dispatcher.BeginInvoke(() => allStationsView.Refresh()));
            Observable.FromEvent <KeyEventArgs>(filter, "KeyDown")
            .Where(x => x.EventArgs.Key == Key.Enter)
            .Subscribe(_ => Dispatcher.BeginInvoke(() =>
            {
                var stations = allStationsView.Cast <Station>().ToArray();
                if (stations.Length == 1)
                {
                    GoToStation(stations[0]);
                }
            }));
            CommonApplicationBarItems.Init(this);
        }
Example #6
0
 private void FilterTextBox_OnTextChanged(object sender, TextChangedEventArgs e)
 {
     _searchText = FilterTextBox.Text;
     CollectionViewSource.Refresh();
 }