C# - 覆盖 OnFileActivated - 没有合适的方法

C# - Override OnFileActivated - No Suitable Method

当遵循示例时here.

此代码引发错误:

protected override void OnFileActivated(FileActivatedEventArgs args)
{
       // TODO: Handle file activation
       // The number of files received is args.Files.Size
       // The name of the first file is args.Files[0].Name
}

错误是:

'MainPage.OnFileActivated(FileActivatedEventArgs)': no suitable method found to override

为什么找不到这个覆盖方法?我正在使用 UWP。

如果您查看文档

https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.application.onfileactivated?view=winrt-19041

您会看到覆盖应该在应用程序上 class,您没有提供代码,但看起来您已尝试在页面上重载它。