继承自 BasePage class

Inheriting from BasePage class

我在徘徊如何实现场景:

我有 class PageBase,其中我有 OnNavigatedTo、OnNavigatedFrom、BackPressed 行为但没有视图(或者如果可能的话只是弹出窗口)。然后我如何在我的 MainPage 中继承这个 class - 我得到错误:

partial decralatcion of page must not specify (...)

对我来说重要的是所有页面看起来都不同,但有些行为是相似的。

除了继承基础class,您还需要更新您的XAML。

<local:PageBase xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                .......