tags:

views:

20

answers:

1

Hi,

I'm having the following Frame in SL4 app. What I want to do is to get a page object navigated inside of the frame to do unit testing (I don't need a URI).

<navigation:Frame Margin="0,0,0,0" JournalOwnership="OwnsJournal" Source="{Binding CurrentPage}">
<navigation:Frame.UriMapper>
    <uriMapper:UriMapper>
        <uriMapper:UriMapping Uri="/User" MappedUri="/Views/UserPage.xaml"/>
        <uriMapper:UriMapping Uri="/Login" MappedUri="/Views/LoginPage.xaml"/>
        <uriMapper:UriMapping Uri="/{pageName}" MappedUri="/Views/{pageName}.xaml"/>
    </uriMapper:UriMapper>
</navigation:Frame.UriMapper>

Could anyone please tell me how to do that?

Thanks in advance,
yokyo

A: 

I found a solution after digging into System.Windows.Control.Navigation.dll with the Reflector for a while. There is no convenient properties to fulfill my requirements, but I can access to a navigated page object by a frame with the following code.

var page = _frame.Content as Page;  // Make sure to run this code after navigating the page

Nothing really is cool, but it works for me.

Cheers,
yokyo

Yoo Matsuo