If you would like to create a base page with common functionality – create your own base page and derive each new page from the base class.
Create BasePage.cs
namespace MyApp.Views
{
public class BasePage:Page
{
}
}
Derive the real page from the BasePage.cs
namespace MyApp.Views
{
public partial class NewPage: BasePage
{
}
}
Now if you compile the project you will get the following error:
Partial declarations of ‘MyApp.Views.NewPage’ must not specify different base classes
Here you should do two more steps:
Change the Xaml accodringly:
from:
namespace MyApp.Views
<navigation:Page x:Class="MyApp.Views.EditArticle"
.../>
</navigation:Page>
to:
<local:BasePage x:Class="MyApp.Views.NewPage"
xmlns:local="clr-namespace:MyApp.Views"
.../>
</local:BasePage>
And the last important thing – Add reference to AssemblyInfo.cs
[assembly: XmlnsDefinition("http://schemas.microsoft.com/client/2007", "MyApp.Views")]
1 Comments.