public PhotoCarouselPage(int position, IEnumerable <object> selectedItem, IList newItems) { InitializeComponent(); _vm = (PhotoCarouselViewModel)(ServiceLocator.Current.GetInstance(typeof(PhotoCarouselViewModel))); this.lstPhoto = selectedItem; this.newItems = newItems; this._position = position; if (lstPhoto != null) { _vm.lstImages = (System.Collections.ObjectModel.ObservableCollection <GalleryImage>)lstPhoto; } _vm.positionItem = position; if (newItems != null) { carouselPhoto.ItemsSource = newItems; } BindingContext = _vm; }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { IDictionary <string, string> parameters = this.NavigationContext.QueryString; if (parameters.ContainsKey("DateId")) { DateId = Int32.Parse(parameters["DateId"]); } if (parameters.ContainsKey("PhotoId")) { PhotoId = Int32.Parse(parameters["PhotoId"]); } photoCarouselViewModel = new PhotoCarouselViewModel(DateId, PhotoId, this); this.DataContext = photoCarouselViewModel; //this.PivotControl.SelectedIndex = 1; base.OnNavigatedTo(e); }