Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9045921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:29:16+00:00 2026-06-16T11:29:16+00:00

By default all code-behind classes inherit from PhoneApplicationPage . I would like to make

  • 0

By default all code-behind classes inherit from PhoneApplicationPage. I would like to make a subclass of PhoneApplicationPage and use it as basis for my code-behind class, like so:

namespace Test
{
    public partial class HistoryRemoverPage : PhoneApplicationPage
    {
        protected override void OnNavigatedTo
            (NavigationEventArgs e)
        {
            if (e.NavigationMode == NavigationMode.New)
                NavigationService.RemoveBackEntry();
        }
    }
}

namespace Test
{
    public partial class MainPage : HistoryRemoverPage 
    {
        public MainPage()
        {
            InitializeComponent();
        }
    }
}

When I try to compile my application I get the following error:

Error 1 Partial declarations of ‘Test.MainPage’ must not specify
different base classes

I believe this has to do with following declaration in MainPage.xaml that points to PhoneApplicationPage instead of my subclass:

phone:PhoneApplicationPage …

But I don’t understand how to fix this. Any advice?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T11:29:17+00:00Added an answer on June 16, 2026 at 11:29 am

    Yes you are on the right track. You need to change the root element in your MainPage.xaml to your custom base class:

    <test:HistoryRemoverPage x:Class="Test.MainPage"                   
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
        <!-- ... ---> 
        xmlns:test="clr-namespace:Test">
    
             <!--LayoutRoot is the root grid where all page content is placed-->
             <Grid x:Name="LayoutRoot" Background="Transparent">
                  <!-- ... --->
             </Gird>    
    
    </test:HistoryRemoverPage>
    

    Note you need add your base class namespace (xmlns:test) in order to specify your base class in XAML.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to remove all default values that have been setup in a particular
When Instantiating a class, Windsor by default treats all public properties of the class
Here is my master page code behind: namespace mysite.MasterPages { public partial class Main
I have an if statement in the code behind for an asp.net page, like
I'm currently analyzing the code behind for a web application. The Default page contains
My requirement is to call WCF web service from ASP.NET code behind and pass
I have a Default.aspx, it has it's code behind, Default.cs.aspx. I have a variable
By default in all browsers, title attributes only show on mouse over. I want
I am trying to block all default methods except create and update in my
when started, jetty per default loads all directories and war-files in its webapps directory,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.