Windows store apps 如何在UWP中启动文件?

Windows store apps 如何在UWP中启动文件?,windows-store-apps,win-universal-app,Windows Store Apps,Win Universal App,我想从appx的本地状态文件夹启动xml文件。我无法使用var file=ApplicationData.current.LocalFolder.GetFileAsync()启动文件; Launcher.LaunchFileAsync(file)。有没有办法在UWP中启动该文件?您打开xml文件时使用的默认选项似乎存在一些问题。我尝试用以下代码启动一个xml文件。它工作得很好。我用来打开xml文件的默认应用程序是MicrosoftEdge string xmlFile = @"TextFile.

我想从appx的本地状态文件夹启动xml文件。我无法使用
var file=ApplicationData.current.LocalFolder.GetFileAsync()启动文件;

Launcher.LaunchFileAsync(file)
。有没有办法在UWP中启动该文件?

您打开xml文件时使用的默认选项似乎存在一些问题。我尝试用以下代码启动一个xml文件。它工作得很好。我用来打开xml文件的默认应用程序是MicrosoftEdge

string xmlFile = @"TextFile.xml";

var file = await ApplicationData.Current.LocalFolder.GetFileAsync(xmlFile);

if (file != null)
 {

     var success = await Launcher.LaunchFileAsync(file);

     if (success)
     {
         // File launched
     }
     else
     {
         // File launch failed
     }
 }
 else
 {
     // Could not find file
 }
请尝试更改默认应用程序以正常加载xml文件