In the Main window I used only one frame:
<window x:class="WpfApplication1CP.MainWindow" xmlns:x="#unknown">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<grid>
<frame source="LoginPage.xaml" navigationuivisibility="Hidden" />
</grid>
</window>
I added two simple pages: LoginPage.xaml and Export.xaml
Here is Loginpage.xaml
<page x:class="WpfApplication1CP.LoginPage" xmlns:x="#unknown">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
Title="LoginPage">;
<grid>
<label content="Login" horizontalalignment="Left" margin="130,155,0,0" verticalalignment="Top/><br mode=" hold=" /> <Button Content=" button=" HorizontalAlignment=" left=" Margin=" top=" Width=" 75=" Click=" button_click_1="/>
</grid>
Now in the button click event:
private void Button_Click_1(object sender, RoutedEventArgs e)
{
var wnd = Window.GetWindow(this);
Grid g = (Grid)wnd.Content;
Frame f=(Frame)g.Children[0];
f.Source = new Uri("Export.xaml", UriKind.RelativeOrAbsolute);
}
We obtain the parent window of Login page which is MainWindow. We obtain the appropriate child which is the placeholder of the frames ( i.e Frame). Update the Frame source.
Hope this helps.