I develop app with setting page include Pivot. On NavigatedTo method, load data from db async and add PivotItem.
BUT, BackPressed event does not fire for N times tap on back button (N = count of dynamic add PivotItem) and after it event call correctly. when i comment dynamic add PivotItem code, BackPressed event work properly.
protected override void OnNavigatedTo(Windows.UI.Xaml.Navigation.NavigationEventArgs e)
{
HardwareButtons.BackPressed += HardwareButtons_BackPressed;
DataService.GetDataFromDB().ContinueWith(data =>
{
RunOnUiThread(() =>
{
data.Result.ForEach(item =>
{
var uc = new FolderUC(item);
var pivotItem = new PivotItem() { Header = item.Title, Content = uc };
pivot.Items.Add(pivotItem);
});
});
});
}
What is wrong????