简体   繁体   中英

What are the requirements for the content parameter in Frame.Navigate?

I'm writing a WPF library where I make use of the Frame.Navigate method. I'm curious to know, what are the requirements for the content parameter passed into the method? Does it require the object to be a subclass of the Page class? If so, then why doesn't it take a Page instead of an object parameter?

I tried looking into the WPF source code here , but I eventually gave up after 10 methods down. MSDN is also pretty vague; it just says "the object that contains the content to navigate to."

Can someone tell me the requirements for this method? Obviously something like Frame.Navigate("Hello world") wouldn't work, so what criteria does the parameter need to meet?

Thanks for helping.

Actually Frame.Navigate("Hello world") works without problems.

There is no limitation on what you can set as the content parameter.

Quote from WPF Unleashed about Frame :

The Frame control holds arbitrary content, just like all other content controls, but it isolates the content from the rest of the user interface. For example, properties that would normally be inherited down the element tree stop when they reach the Frame . In many respects, WPF Frame s act like frames in HTML.

So it's just another content control, which separates its content from the rest of the application (by not inheriting properties) and offering built-in navigation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM