'Accessing a xaml.cs file from another xaml.cs file

is it possible to cast to another xaml.cs file without creating a new object of that class.

For example, you can use this to access MainWindow variables/methods.

MainWindow window = (MainWindow)Application.Current.MainWindow;

My question: is it possible to do something like the above but for another page that is not main window. example:

MyPage window = (MyPage )Application.Current.MyPage;

reason for needing is say if a frame.source has a loaded xaml page, i want to access that pages functions to get current info on that page. if you create a new object of that page then i can not get the data i want.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source