Ejemplo n.º 1
0
        private void OnParameterNavigation <TK>(object newContent, ParameterNavigationEventArgs <TK> e)
        {
            (newContent as IContent)?.OnNavigatedTo(e);
            var frameworkElement = newContent as FrameworkElement;

            (frameworkElement?.DataContext as IContent)?.OnNavigatedTo(e);
        }
Ejemplo n.º 2
0
        private void SetContent <TK>(Uri newSource, NavigationType navigationType, object newContent, bool contentIsError, TK passingParameter)
        {
            // assign content
            Frame.Content = newContent;
            // do not raise navigated event when error
            if (!contentIsError)
            {
                var args = new ParameterNavigationEventArgs <TK>
                {
                    Frame          = Frame,
                    Source         = newSource,
                    Content        = newContent,
                    NavigationType = navigationType,
                    Parameter      = passingParameter
                };

                OnNavigated(Frame.Content, newContent, args);

                OnParameterNavigation(newContent, args);
            }
            // set IsLoadingContent to false
            Frame.SetValue(ModernFrame.IsLoadingContentPropertyKey, false);

            if (contentIsError)
            {
                return;
            }

            // and raise optional fragment navigation events
            string fragment;

            NavigationHelper.RemoveFragment(newSource, out fragment);

            if (fragment == null)
            {
                return;
            }

            // fragment navigation
            var fragmentArgs = new FragmentNavigationEventArgs
            {
                Fragment = fragment
            };

            OnFragmentNavigation(newContent, fragmentArgs);
        }