public ItemsPage() { InitializeComponent(); //sets DataContext _dataContext = new ItemsPageVM(); DataContext = _dataContext; ItemsLstBx.SelectedIndex = 0; }
public ItemsPage(ItemsPageVM itemsPageVM) { InitializeComponent(); }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. The Parameter /// property is typically used to configure the page.</param> protected async override void OnNavigatedTo(NavigationEventArgs e) { // TODO: Assign a bindable collection of items to this.DefaultViewModel["Items"] if ((e.Parameter as ObservableCollection <Pin>) != null) { pageTitle.Text = "Loend"; ivm = new ItemsPageVM(e.Parameter as ObservableCollection <Pin>); } else if ((e.Parameter as string) != null) { pageTitle.Text = "Otsingu päring: " + (e.Parameter as string); var vm = new MainWindowVM(); if (helper.hasInternet(false)) { if (App.ZoomLoc == null) { App.ZoomLoc = new ZoomedLocation(); App.ZoomLoc.Loc = vm.MyLocation; App.ZoomLoc.MapLookType = MapType.Road; await vm.setGeoLocation(new Location(58.644817399944429, 25.066338372170776)); } else { await vm.setGeoLocation(App.ZoomLoc.Loc); } await vm.loadPins(e.Parameter as string); if (vm.Pushpins.Count == 0) { pageTitle.Text = "Ei leitud vastuseid: " + (e.Parameter as string); } else { pageTitle.Text = "Otsingu päring (" + vm.Pushpins.Count + " objekti): " + (e.Parameter as string); } ivm = new ItemsPageVM(vm.Pushpins); progressBar.Maximum = ivm.Pinlist.Count; } else { MessageDialog dialog = new MessageDialog("Otsing vajab ligipääsu internetti."); await dialog.ShowAsync(); if (!App.askedInternetatStart) { App.Current.Exit(); return; } } App.askedInternetatStart = true; } pins = new ObservableCollection <Pin>(); progressBar.Value = 0; itemGridView.ItemsSource = pins; itemListView.ItemsSource = pins; PinUpdate(); base.OnNavigatedTo(e); }