Understand the source, currentsource, and content attributes of the frame in the navigation, and the URI and content attributes of the navigationeventargs type in the navigation event.
In the navigating and navigated events of the frame, insert the following debugging:Code:
Debug.Writeline ("Navigationeventargs. Uri :" +E.Uri );
Debug.Writeline ("Navigationeventargs. Content :" +E.Content );
Debug.Writeline ("Frame. Source :" +Frame.Source );
Debug.Writeline ("Frame. currentsource :" +Frame.Currentsource );
Debug.Writeline ("Frame. Content :" +Frame.Content );
When the source of the frame is defined as page1.xaml, the data after the form is displayed (mgen_wpf isProgramSet Name is also the default namespace ):
=== Navigating ===
Navigationeventargs. Uri: mgen_wpf; component/page1.xaml
Navigationeventargs. content:
Frame. Source: page1.xaml
Frame. currentsource:
Frame. content:
=== Navigated ===
Navigationeventargs. Uri: mgen_wpf; component/page1.xaml
Navigationeventargs. Content: mgen_wpf.page1
Frame. Source: mgen_wpf; component/page1.xaml
Frame. currentsource: mgen_wpf; component/page1.xaml
Frame. Content: mgen_wpf.page1
As you can see, when the first navigating occurs, only the URI of frame. Source and navigationeventargs has a value. When navigated occurs, the content of navigationeventargs and frame are parsed page objects. And the currentsource of the frame is equal to the source attribute.
When you navigate from a link of page1 to page2, the data is as follows:
=== Navigating ===
Navigationeventargs. Uri: mgen_wpf; component/page2.xaml
Navigationeventargs. content:
Frame. Source: mgen_wpf; component/page2.xaml
Frame. currentsource: mgen_wpf; component/page1.xaml
Frame. Content: mgen_wpf.page1
=== Navigated ===
Navigationeventargs. Uri: mgen_wpf; component/page2.xaml
Navigationeventargs. Content: mgen_wpf.page2
Frame. Source: mgen_wpf; component/page2.xaml
Frame. currentsource: mgen_wpf; component/page2.xaml
Frame. Content: mgen_wpf.page2
Not to mention navigated. When the navigation ends, all attributes are related to page2. The navigating attribute, except that the content and currentsource of the frame are page1, is related to page2.
When you navigate from page1 to the network address, the data is as follows:
=== Navigating ===
Navigationeventargs. Uri: The http://www.baidu.com/
Navigationeventargs. content:
Frame. Source: http://www.baidu.com/
Frame. currentsource: mgen_wpf; component/page1.xaml
Frame. Content: mgen_wpf.page1
=== Navigated ===
Navigationeventargs. Uri: The http://www.baidu.com/
Navigationeventargs. Content: system. Windows. Controls. webbrowser
Frame. Source: http://www.baidu.com/
Frame. currentsource: http://www.baidu.com/
Frame. Content: system. Windows. Controls. webbrowser
The logic is similar to the above, but the address directly changes to the network address, and the space object is the WPF webbrowser control.