WPF: changes in the navigation of frame members

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.