I have a Page which is loaded inside a Frame element via it’s Source property. I need to get access to the Frames .BackStack property from the source xaml’s code-behind… Is that possible?
so roughly the code is –
<Frame x:Name='contentFrame' Source='ProjectsPage.xaml'/>
in the ProjectsPage.xaml.cs i want to access properties on its parent frame.
Navigation history is one area in which WPF is sorely deficient. No, I don’t believe there’s any way to get at the BackStack of the Frame from the page. You could implement a bit of a hack, if you don’t need to do this generically. Hook the navigation events of the Frame, and set an attached dependency property to the Frame on any DependencyObject that’s navigated to. Unfortunately, there’s not much you can do with the BackStack, but I assume you’ve already determined it’s good enough for what ever you’re doing.