Okra vs LayoutAwarePage

Oct 2, 2012 at 5:13 PM

How does Okra work with (or against) the LayoutAwarePage provided by default?  This class is provided by default with new WinRT projects and provides Navigation and State Management methods, along with visual state switching (orientation, snap). 

Does Okra integrate with LayoutAwarePage or replace it?  Does it cover all the same ground?

Coordinator
Oct 3, 2012 at 9:41 AM

Okra should work fine alongside the default LayoutAwarePage (in fact I would advise you still keep this as your base class for pages).

For the navigation and state management aspects the Okra support replaces that in LayoutAwarePage as it has a different page discovery model (more suited for MVVM applications) and page lifetime handling. This isn't a problem as LayoutAwarePage doesn't do anything with respect to navigation unless you specifically call the methods. The visual state switching support of LayoutAwarePage is still useful in Okra based apps as this works fine as is.

For my applications my approach is,

  • Derive all pages from LayoutAwarePage
  • Use Okra support for all navigation and state management
  • Use the visual states for orientation/snap/etc. (handled by LayoutAwarePage)

Hopefully you can see that the LayoutAwarePage and Okra are complimentary and work great together.

Regards,

    Andy

Oct 4, 2012 at 2:08 AM

I can confirm that it works just fine, we're using LayoutAwarePage in our application alongside Okra just fine.