System.Windows.Data.CollectionViewSource.Refresh C# (CSharp) Method

Refresh() private method

private Refresh ( ) : void
return void
		void Refresh ()
		{
			if (((IDeferRefresh) this).DeferLevel != 0 || View == null)
				return;

			using (View.DeferRefresh ()) {
				View.Culture = Culture;
				View.GroupDescriptions.Clear ();
				for (int i = 0; i < GroupDescriptions.Count; i++)
					View.GroupDescriptions.Add (GroupDescriptions [i]);

				View.SortDescriptions.Clear ();
				for (int i = 0; i < SortDescriptions.Count; i++)
					View.SortDescriptions.Add (SortDescriptions [i]);

				View.Filter = (filter == null) ? null : FilterCallback;
			}
		}

Usage Example

 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);
 }
All Usage Examples Of System.Windows.Data.CollectionViewSource::Refresh