Wednesday, February 7, 2007

Navigating - and Another MCMLPad Warning

There's another minor bug/issue in MCMLPad - something you should be aware of once you start doing more advanced development.

To navigste from 'page' to 'page' (eg. between UI's) you can use the <Navigate> action within any Rule.

The only required member of this tag is URI - the address to the next page. Most frequently, this will be a link to an MCML file that you have enclosed in a resource (usually the same DLL that contains your .NET application).

You can also pass objects in this Navigate tag. Since Navigate opens another UI as the main interface, you pass objects to this new UI exactly the same way that you do between UI's in a single interface - by passing them as properties.

So, for example, you can create a property on the base-UI in 'Page2.mcml', and set it with the Navigate tag in 'Page1.mcml'. This is how you can continue to pass information between pages and propagate information through your entire application.

ONE WORD OF WARNING: MCMPad has a small glitch (I hesistate to call it a 'bug', but it IS annoying) where pressing F5 to refresh the page will NOT work correctly for any page that has been passed a property. The property will not be re-sent, which means that any strings will be reset to empty and any objects will be set to 'null', which will normally mean that MCMLPad will close with an exception.

3 comments:

Unknown said...

I don't suppose you could give an example could you? I have the following in page 1;

<Navigate Source="@resx://FlickrMCEVista/Millmore.Resources/Picture">
<Data>
<cor:String Name="PhotoId" cor:String="Hello"/>
</Data>
</Navigate>


and in page 2, I have the following;

<Properties>
<cor:String Name="PhotoId" cor:String="$Required"/>
</Properties>


and page 2 does not pick up the value "Hello". I have no idea why not.

Ignorance said...

I think you are over-complicating things a bit :)

Try <Navigate Source='@resx://stuff/file.mcml' PhotoId='Hello'>

Unknown said...

Ah! So simple! That worked great. Thanks for the swift response.