Click here to Skip to main content
15,892,480 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have some code that I keep repeating in different code behind pages in my WPF Pages. I want to have a BasePage to inherit them from in order to simplify the process of adding these functions in. I have created a base class called MMMBasePage which is just as C# class that inherits from Page. In the code behind I have replace the first with the second.


public partial class Home : Page

public partial class Home : MMSBasePage


In the XAML I seem to be doing something wrong but as far as I can tell I did it correctly.

<src:MMSBasePage x:Class="MMS.Home"
      xmlns:src="clr-namespace:MMS"
      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" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:uc="clr-namespace:MMS.UserControls"
      xmlns:filter="clr-namespace:DataGridFilterLibrary;assembly=DataGridFilterLibrary"
      mc:Ignorable="d" 
      d:DesignHeight="600" d:DesignWidth="1000"
      Title="Home" Loaded="Page_Loaded">


After a build it starts with the error

"A property 'Title' does not exist in XML namespace 'clr-namespace:MMS'. Line 12 Position 7.
Posted

Never mind. With all the different iterations I was going through, this last one I forgot to put the : Page back into the base class. Doh! Thanks for looking anyway.
 
Share this answer
 
I didn't see the "I've solved this myself button. As stated previously, I forgot in the last round to inherit my MMSBasePage from Page.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900