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);
}