Keval Langalia
Keval Langalia

Reputation: 1892

open specific file in appropriate app from inside Windows 8 App

I'm creating Windows 8 app in which i need to list specific files in a page and then let user open that file. I'm using C# as backend.

I want to ask this (as in the image below), to my user when they try to open any app listed in my app page.

when user select specific app, then the file that is clicked should open in that app.

when user select specific app, then the file that is clicked should open in that app.

Upvotes: 0

Views: 177

Answers (1)

WiredPrairie
WiredPrairie

Reputation: 59793

Unlike previous versions of Windows, the User is now in control of file associations.

To show the launch using the Window above, you can refer to the complete example of launching options here.

The core of it is deciding on a Point on the screen (which is openWithPosition in the example below) and then calling LaunchUriAsync with the options set to display the window.

var options = new Windows.System.LauncherOptions(); 
options.DisplayApplicationPicker = true; 
options.UI.InvocationPoint = openWithPosition; 
options.UI.PreferredPlacement = Windows.UI.Popups.Placement.Below; 

// Launch the URI. 
bool success = await Windows.System.Launcher.LaunchUriAsync(uri, options); 

The linked example code contains a function that can compute a reasonable Point given a XAML element.

Upvotes: 4

Related Questions