In previous implementation there was no mechanims to inform
ScrollableBase to relayout when content changed.
This fix allows to remove some workaround code.
Change-Id: I7b09a92db2dc2a880043b7e0f6f767bbdf78af7c
{
propertyNotification.Notified -= OnPropertyChanged;
mScrollingChild.RemovePropertyNotification(propertyNotification);
+ mScrollingChild.Relayout -= OnChildRelayout;
}
mScrollingChild = view;
+ mScrollingChild.Relayout += OnChildRelayout;
+
propertyNotification = mScrollingChild?.AddPropertyNotification("position", PropertyCondition.Step(1.0f));
propertyNotification.Notified += OnPropertyChanged;
}
}
+ private void OnChildRelayout(object sender, EventArgs args)
+ {
+ Layout.RequestLayout();
+ }
+
/// <summary>
/// Called after a child has been removed from the owning view.
/// </summary>
container.PreviousButton.Hide();
container.Content = carousel;
- // workaround issue with ScrollableBase not properly scrolling
- // to nth page during creation
- Timer timer = new Timer(500);
- timer.Tick += (sender, args) => {
- int index = manager.Languages.FindIndex(x => x == manager.CurrentLanguage);
- carousel.SelectedItemIndex = index;
- return false;
- };
- timer.Start();
-
return container;
}
}