Q:

Creating a metro style app and adding it to openwith context menu

I'm willing to create a metro style app similar to Windows Photo Viewer.
For that I need to add my app in the Openwith context menu. Also, the image file selected in the windows explorer should open in my Photo Viewer. How to open the app with the selected image file as a parameter?
Thanks in advance

Thanks a lot @Filip
I wrote the following code in OnFileActivated(FileActivatedEventArgs args) in App.xaml.cs
protected override void OnFileActivated(FileActivatedEventArgs args)
        {
            // TODO: Handle file activation

            // The number of files received is args.Files.Size
            // The first file is args.Files[0].Name
            base.OnFileActivated(args);
            StorageFile file = args.Files[0] as StorageFile;

            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();
                //rootFrame.SourcePageType = typeof(ImageViewer);

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(ImageViewer), file))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }

But, my app doesn't display anything on opening. So what according to you can be the flaw?

A:

If you edit your Package.appxmanifest to add a File Type Association in the Declarations tab of the manifest editor - your app will become one of the apps that can open the file type that you specify. You then just need to add an override to your App class to handle the file activation as described in this article:
protected override void OnFileActivated(FileActivatedEventArgs args)
{
   // TODO: Handle file activation

   // The number of files received is args.Files.Size
   // The first file is args.Files[0].Name
}

