Reputation: 1600
I'd like to create a custom WPF Page class that all of my Pages derive from:
public class CustomPage : Page
{
// custom dependency props here...
}
I don't understand how to then create a new Page in my Visual Studio project and then have it use the Custom Page type. The problem is the root element in the Page's XAML. How do I declare it? This doesn't work:
<local:CustomPage
xmlns:local="clr-namespace:MyProject"
x:Class="KinectLevelUp.CustomSwipe.Views.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
<Grid>
<!-- page content here... -->
</Grid>
</local:CustomPage>
I believe I just don't understand how to qualify the CustomPage type at the root element level.
Upvotes: 1
Views: 1669
Reputation: 887453
You need to change your code-behind file to inherit CustomPage
too.
Upvotes: 2