I have a frame that i initialized in xaml like this:
<window>
<Frame Name="myframe" NavigationUIVisibility="Hidden" Source="mypage.xaml"/>
</window>
I'm trying to get the page instance from the window that contains the frame (which in order contains the page) in c# code and i don't know how to get it.
public partial class mywindow : Window
{
public mywindow()
{
BusinessLogic.Initialize();
InitializeComponent();
var a = myframe.Content;
}
}
how do i get it?
thank you
Your code is correct, but lack cast the return of Content.
public partial class mywindow : Window
{
public mywindow()
{
BusinessLogic.Initialize();
InitializeComponent();
var a = (MyPage)myframe.Content;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With