This question is related very closely to a question I asked earlier on this Forum. My original question has been answered very kindly by Sargani. Sargani has also suggested the best approach to solve my problem would be using Binding and have my code written using MVVM (No code behind). The solution provided by Sargani is working fine, but I would like to understand and learn this alternative approach also and would be grateful for help with this.
My original question and its solution are posted here.
I have put the XAML for all three pages in my Project and their relavant code behind in my original question.
I would rephrase my original question here as follows.
I have a very simple Silverlight Application with a MainPage and two other Pages (Page1 and Page2). MainPage has two Grids. One of the Grid has a couple of Buttons (cmdPage1 and cmdPage2) and a RichTextBox named txtNotes on it. Clicking one of the these Buttons (cmdPage1) opens Page2 into the second Grid on Main page as its child. I would like to be able to type a word such as “Happy” into txtNotes, programmatically by clicking a button on Page1 which is visible inside MainPage as its Child after clicking cmdPage1 on MainPage . To achieve this I need to access txtNotes on MainPage from the Click event of the Button on Page1. However this was not easy.