Currently I have a main form, from which I call a popup that I’ve created in a seperate XAML file for my spellchecker. It’s called like so:
SpellCheckerPopupControl popupControl = new SpellCheckerPopupControl();
popupControl.SpellChecklistBox.Items.Clear();
//some code to check the word and populate the child listbox with spelling suggestions
popupControl.SpellCheckerPopup.IsOpen = true;
I have an event setup in the child on SelectionChanged in the listbox for it to pass the data back to the main form, currently I just want to pass the selection back to my main form so that I can take the selected word and replace the misspelled one with it. Unfortunately, I don’t seem to be able to pass data from the child form’s events back to the parent.
The XAML for the SpellCheckerPopup is just a <PopUp> with a <ListBox> inside it.
Just for testing purposes, I’ve tried to just take the output of what happens and paste the string into the main textbox like so: MainPage.txtArticle.Text = s;, but while the MainPage bit is available, none of its elements are, and as such I cannot manipulate them from the child event.
Make a property of the window
then on window.closed event check for
Window.txtArticle.Text;This should work. If not, then bind them to properties in the code behind.
[update]
Example:
this code goes in your main page.
hope this helps.