I have a carousel page inside a navigation page and I am trying to update the title in the navigation bar according to the title of the current page in in the carousel.
My code is the following:
public class HomePage : CarouselPage
{
private HomeViewModel ViewModel
{
get { return BindingContext as HomeViewModel; }
}
public HomePage()
{
var homeViewModel = new HomeViewModel();
BindingContext = homeViewModel;
}
protected override void OnCurrentPageChanged()
{
base.OnCurrentPageChanged();
System.Diagnostics.Debug.WriteLine(CurrentPage.Title);
Title = CurrentPage.Title;
}
}
The thing is that I am correctly receiving the "OnCurrentPageChanged" event but the property CurrentPage corresponds always to the first page in the carousel and not the correct page that is displayed on my UI.
Is it a Xamarin.Forms bug?