Example #1
0
        private void ClosePickerPage()
        {
            // Unhook from events
            if (null != _frame)
            {
                _frame.Navigated         -= OnFrameNavigated;
                _frame.NavigationStopped -= OnFrameNavigationStoppedOrFailed;
                _frame.NavigationFailed  -= OnFrameNavigationStoppedOrFailed;

                // Restore host page transitions for the completed "popup" navigation
                var frameContentWhenOpenedAsUiElement = _frameContentWhenOpened as UIElement;
                if (null != frameContentWhenOpenedAsUiElement)
                {
                    TransitionService.SetNavigationInTransition(frameContentWhenOpenedAsUiElement, _savedNavigationInTransition);
                    _savedNavigationInTransition = null;

                    TransitionService.SetNavigationOutTransition(frameContentWhenOpenedAsUiElement, _savedNavigationOutTransition);
                    _savedNavigationOutTransition = null;
                }

                _frame = null;
                _frameContentWhenOpened = null;
            }

            // Commit the value if available
            if (null != _valuePickerPage)
            {
                if (_valuePickerPage.Value.HasValue)
                {
                    Value = _valuePickerPage.Value.Value;
                }
                _valuePickerPage = null;
            }
        }
Example #2
0
 private void OnFrameNavigated(object sender, NavigationEventArgs e)
 {
     if (e.Content == _frameContentWhenOpened)
     {
         // Navigation to original page; close the picker page
         ClosePickerPage();
     }
     else if (null == _valuePickerPage)
     {
         // Navigation to a new page; capture it and push the value in
         _valuePickerPage = e.Content as IValuePickerPage <T>;
         if (null != _valuePickerPage)
         {
             NavigateToNewPage(e.Content);
         }
     }
 }