locked
Suspending Error When Passing ViewModel to Frame.Navigate

    Question

  • I know about the problem where passing in a complex class to Frame.Navigate results in an exception on suspend ("GetNavigationState doesn't support serialization of a parameter type which was passed to Frame.Navigate") but I thought I read somewhere that this was changed/fixed in 8.1, allowing for ViewModels to be passed to Frame.Navigate.

    Of course, now I can't find whatever I thought had told me this.  Is this just wishful thinking?

    Thursday, July 24, 2014 1:58 PM

Answers

  • It's wishful thinking. Check the docs:

    The navigation parameter to pass to the target page; must have a basic type (string, char, numeric, or GUID) to support parameter serialization using GetNavigationState.
    You can serialize the ViewModel to a string (if it's small) or stow it in a lookaside table and pass the key.

    --Rob

    Thursday, July 24, 2014 8:41 PM
    Owner