wpf how to send string or info on anther page or window or usercontrol

i have big problem visual studio wpf , when i try to send any string it doesn't work i tried to write public string str { set; get; } This problem has been stuck with it for a long time, I tried a lot to use crooked methods, but the program or project crashes.

im using visual studio wpf c#

thank you for answer

enter image description here

enter image description here

enter image description here

public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void button1_MouseEnter(object sender, MouseEventArgs e)
        {
            Info.Content = "Hello world";
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            Frame.Content = new Page1();
        }

        private void button2_MouseLeave(object sender, MouseEventArgs e)
        {
            Info.Content = "Label";
        }

        private void button1_MouseLeave(object sender, MouseEventArgs e)
        {
            Info.Content = "Label";
        }
    }

here Page class

public partial class Page1 : Page
    {
        public Page1()
        {
            InitializeComponent();
        }

        private void button1_MouseEnter(object sender, MouseEventArgs e)
        {
            MainWindow mw = new MainWindow();
            mw.Info.Content = "Test Public";
        }
    }


Solution 1:

Update Page1's button1_MouseEnter code to:

private void button1_MouseEnter(object sender, MouseEventArgs e)
{
    MainWindow mw = Application.Current.Windows.OfType<MainWindow>().First();

    mw.Info.Content = "Test Public";
}

or

private void button1_MouseEnter(object sender, MouseEventArgs e)
{
    MainWindow mw = (MainWindow)Application.Current.MainWindow;

    mw.Info.Content = "Test Public";
}