Q:

Universal windows app to send data from one page to another

I had partitioned the MainPage.xaml in two parts. The Left part has some buttons which will give command to change the Right part with new Page. So I created three right pages for ex. RightPage1, RightPage2 and RightPage3. The problem is that, I want to show data on Left part after the operations done on RightPage1, 2 or 3.
Should I follow some pattern to fulfill this approach? or we can do it directly in code behind?
All I researched is giving me solution to navigate to that page and send the data in parameter. But I don't want to open the page again, because it's already opened on the Left side of MainPage. Please help me to solve this situation.
In RightPage 1, on Submit Click Event I want to show some message in MainPage.xaml's Left part in TextBlock lblClassName.
HomePage.xaml

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="5*"/>
        <ColumnDefinition Width="3*"/>
    </Grid.ColumnDefinitions>
    <RelativePanel>
        <Button x:Name="btn1"
                Content="Button 1"
                Height="50" Width="100" Margin="0,30,0,0"
                RelativePanel.AlignHorizontalCenterWithPanel="True"
                Click="btn1_Click"/>
        <Button x:Name="btn2"
                Content="Button 2"
                Height="50" Width="100" Margin="0,30,0,0"
                RelativePanel.AlignHorizontalCenterWithPanel="True"
                RelativePanel.Below="btn1"
                Click="btn2_Click"/>
        <Button x:Name="btn3"
                Content="Button 3"
                Height="50" Width="100" Margin="0,30,0,0"
                RelativePanel.AlignHorizontalCenterWithPanel="True"
                RelativePanel.Below="btn2"
                Click="btn3_Click"/>

        <TextBlock x:Name="lblWrite"
                   Text="Write something : "
                   Visibility="Visible"
                   RelativePanel.Below="btn3"/>
        <TextBox x:Name="txtWrite"
                 Height="50" Width="150"
                 Visibility="Collapsed"
                 RelativePanel.Below="lblWrite"/>
        <Button x:Name="btn3_1"
                Height="50" Width="100"
                Visibility="Collapsed"
                Content="Send"
                RelativePanel.Below="txtWrite"/>

        <TextBlock x:Name="lblClassName"/>

    </RelativePanel>
    <Frame x:Name="RightPage"
           Grid.Column="1"/>
</Grid>

RightPage1.xaml

<Grid Background="Beige">
        <TextBlock x:Name="heading"
                   Text="Teacher Module"
                   RelativePanel.AlignHorizontalCenterWithPanel="True"/>
        <TextBlock x:Name="lblName"
                   Text="Name" Margin="0,30,0,0"
                   RelativePanel.AlignHorizontalCenterWithPanel="True"
                   RelativePanel.Below="heading"/>
        <TextBox x:Name="txtName"
                 Height="30" Width="150" Margin="30,30,0,0"
                 RelativePanel.RightOf="lblName"
                 RelativePanel.Below="heading"/>
        <TextBlock x:Name="lblClass"
                   Text="Class" Margin="0,30,0,0"
                   RelativePanel.AlignHorizontalCenterWithPanel="True"
                   RelativePanel.Below="lblName"/>
        <TextBox x:Name="txtClass"
                 Height="30" Width="150" Margin="30,10,0,0"
                 RelativePanel.RightOf="lblClass"
                 RelativePanel.Below="txtName"/>
        <Button x:Name="btnSumbit"
                Content="Submit"
                Height="50" Width="100" Margin="0,30,0,0"
                RelativePanel.AlignHorizontalCenterWithPanel="True"
                RelativePanel.Below="lblClass"/>
        <Button x:Name="btnCancel"
                Content="Cancel"
                Height="50" Width="100" Margin="30,30,0,0"
                RelativePanel.AlignHorizontalCenterWithPanel="True"
                RelativePanel.Below="lblClass"
                RelativePanel.RightOf="btnSumbit"/>

        <TextBlock x:Name="lblResult"
                   Margin="0,30,0,0"
                   RelativePanel.Below="btnSumbit"/>
    </RelativePanel>
</Grid>

A:

I think we can do it directly in code behind. For example:
In the code-behind of HomePage.xaml, we can define a static field in HomePage that represent the HomePage itself and add a public method to change the TextBlock's text.
public sealed partial class HomePage : Page
{
    //define a static field represent the HomePage itself
    public static HomePage Home;

    public HomePage()
    {
        this.InitializeComponent();
        //initialize Home field
        Home = this;
    }

    ...

    /// <summary>
    /// Show some message in TextBlock lblClassName
    /// </summary>
    /// <param name="message">message to been shown</param>
    public void ChangeMessage(string message)
    {
        this.lblClassName.Text = message;
    }
}

Then in Submit Click event, we can call ChangeMessage method to show the message.
private void btnSumbit_Click(object sender, RoutedEventArgs e)
{
    HomePage.Home?.ChangeMessage("The message you want to show");
}

