我创建了一个Windows8空白xaml应用程序。现在我想将此应用程序作为共享目标。我已按照以下链接的说明进行操作,并能够将其作为目标应用程序。
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/Hh973053
但是我在空白的xaml应用程序中添加以下方法(OnShareTargetActivated)?当我在mainpage.xaml.cs中手动添加此方法时,它会显示错误“
“Project.MainPage.OnShareTargetActivated(Windows.ApplicationModel.Activation.ShareTargetActivatedEventArgs)'是密封类中的新虚拟成员”
“Project.MainPage.OnShareTargetActivated(Windows.ApplicationModel.Activation.ShareTargetActivatedEventArgs)”:找不到合适的方法来覆盖“
protected override async void OnShareTargetActivated(ShareTargetActivatedEventArgs args)
{
// Code to handle activation goes here.
}
答案 0 :(得分:0)
它继承自Windows.UI.Xaml.Application的类。通常是App.cs.
E.g。
sealed partial class App : Application
{
public App()
{
this.InitializeComponent();
}
//...
protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args)
{
var rootFrame = new Frame();
rootFrame.Navigate(typeof(MainPage), args.ShareOperation);
Window.Current.Content = rootFrame;
Window.Current.Activate();
}
}