/// <summary> /// Initializes a new instance of the <see cref="FavoriteWrapper"/> class. /// </summary> /// <param name="favorite">The favorite map pin.</param> /// <param name="viewModel">The reference to the current view model.</param> public FavoriteWrapper(MapExPin favorite, FavoritesViewModel viewModel) { // Store the current favorite this.favorite = favorite; this.viewModel = viewModel; // Setup commands this.SetAsPrimaryCommand = new Command(this.SetAsPrimary); this.RemoveFavoriteCommand = new Command(this.RemoveFavorite); }
/// <summary> /// Handles the BindingContextChanged event. /// </summary> protected override void OnBindingContextChanged() { // Remove the event handling from the binding context if (this.currentBindingContext != null) { this.currentBindingContext.Navigation = null; } // Set up the event handling from the binding context this.currentBindingContext = this.BindingContext as FavoritesViewModel; if (this.currentBindingContext != null) { // Set up navigation context this.currentBindingContext.Navigation = this.Navigation; } // Call the base member base.OnBindingContextChanged(); }