I have an app that allows the user to capture and manipulate an image, there is a need to do this multiple times with multiple images, so I would like to write my image capture and manipulation steps as a custom/user component so I don't need to repeat the code.
To explain the flow simply, I currently have:
Page 2 and 3 above (related to camera and image processing) should be in the component. Then I can have multiple versions of page 1, that will call the component with the user provided parameters. The component would then return back to the calling page.
I'm unsure how to achieve my desired flow or if it's even possible. I can create a class e.g. CameraComponent
and then call it from Page 1, but how would my component to change the screen to page 2, and when done return to page 1? I would also want my component to accept a custom model/object, and also return an object back via a callback or other mechenism so that Page 1 knows the result of the CameraComponent operation.
Any guidence is most appreciated, particularly around changing the navigation. Is it recommended/wise to pass a reference to Frame and then change navigation from within my component?
It is not possible to nest Frames inside Windows Phone 8, so you can't have a component that consists of multiple Pages (it would have to replace the entire Page from which it is called). The good news is you don't really need to use the actual PhoneApplicationPage
class for this - you can simply show and hide the various "page" items by loading and unloading different UserControl
instances.
Consider reading this old blog post for some background.