How to access a XAML element in a nested frame in C# -


i trying access contents of richeditbox contained inside xaml page contained inside page invoked app.xaml.cs file. following explains situation.

my app.xaml.cs file can access elements in mainpage.xaml following:

var mainpage = windows.ui.xaml.window.current.content mainpage; 

my mainpage.xaml file includes following:

<frame x:name="rootframe" x:fieldmodifier="public"/> 

which gets linked instance editor.xaml / editor.xaml.cs.

from mainpage.xaml.cs can access richeditbox named editorbox inside editor.xaml following:

var editor = rootframe.content editor; string textboxtext; editor.editorbox.document.gettext(windows.ui.text.textgetoptions.none, out textboxtext); 

what contents of richeditbox (editorbox) app.xaml.cs file can save them when app suspends.

i have tried combining commands above in ways following:

var mainpage = windows.ui.xaml.window.current.content mainpage; var editor = mainpage.rootframe.content editor; string textboxtext; editor.editorbox.document.gettext(windows.ui.text.textgetoptions.none, out textboxtext); 

but doesn't work. when app tries suspend, gets system.nullreferenceexception on line:

var editor = mainpage.rootframe.content editor; 

how can resolve problem , retrieve contents of richeditbox app.xaml.cs file?


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -