Reputation: 446
There is any way to change Page for a custom class that inherits from Page? I mean in a XAML.
Thank you.
Upvotes: 0
Views: 564
Reputation: 29790
If you want to use your extended Page class in XAML then you have to exchange all clases of this page - in XAML and partial classes in code. A sample example:
<shl:PageWithNotify
x:Class="MyProject.Pages.MyPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:shl="using:AppExtensions">
<shl:PageWithNotify.Resources>
.. some more code
The page class defined in AppExtensions:
public class PageWithNotify : Page, INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
// rest of your code
And the partial Page class in code:
public sealed partial class MyPage : PageWithNotify
{
// your code
Upvotes: 2