Monotouch Dialog: Passing data up the navigation tree

82 views Asked by At

I was wondering if you could help me with a problem:

Consider the following dialog which contains two screens. The first screen shows a StringElement (called 'address') along with a RootElement which navigates to the second screen which has an EntryElement (called 'searchAddress').

RootElement root = new RootElement("Welcome");
StringElement address = new StringElement("Address","");
EntryElement searchAddress = new EntryElement("Enter an address","");

root.Add(new Section(){
     address,
     new RootElement("Search for Address"){
         searchAddress
     }
}
Root = root;

Problem: How do I pass the contents/Value of searchAddress (EntryElement) back to address (StringElement) on the previous screen?

1

There are 1 answers

0
jmgomez On BEST ANSWER

You just have to implement the Changed event on the EntryElement and then call to Dialog.ReloadData(),something like this:

    searchAddress.Changed += (s,e) => {
            address.Value = searchAddress.Value;
            this.ReloadData();
        };