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

  • SEARCH
  • Home
  • 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 36283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:22:08+00:00 2026-05-10T14:22:08+00:00

I have decided that all my WPF pages need to register a routed event.

  • 0

I have decided that all my WPF pages need to register a routed event. Rather than include

public static readonly RoutedEvent MyEvent= EventManager.RegisterRoutedEvent('MyEvent', RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(BasePage)); 

on every page, I decided to create a base page (named BasePage). I put the above line of code in my base page and then changed a few of my other pages to derive from BasePage. I can’t get past this error:

Error 12 ‘CTS.iDocV7.BasePage’ cannot be the root of a XAML file because it was defined using XAML. Line 1 Position 22. C:\Work\iDoc7\CTS.iDocV7\UI\Quality\QualityControlQueuePage.xaml 1 22 CTS.iDocV7

Does anyone know how to best create a base page when I can put events, properties, methods, etc that I want to be able to use from any wpf page?

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-10T14:22:08+00:00Added an answer on May 10, 2026 at 2:22 pm

    Here’s how I’ve done this in my current project.

    First I’ve defined a class (as @Daren Thomas said – just a plain old C# class, no associated XAML file), like this (and yes, this is a real class – best not to ask):

    public class PigFinderPage : Page {     /* add custom events and properties here */ } 

    Then I create a new Page and change its XAML declaration to this:

    <my:PigFinderPage x:Class='Qaf.PigFM.WindowsClient.PenSearchPage'     xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'     xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'     xmlns:my='clr-namespace:Qaf.PigFM.WindowsClient'     /> 

    So I declare it as a PigFinderPage in the ‘my’ namespace. Any page-wide resources you need have to be declared using a similar syntax:

    <my:PigFinderPage.Resources>     <!-- your resources go here --> </my:PigFinderPage.Resources> 

    Lastly, switch to the code-behind for this new page, and change its class declaration so that it derives from your custom class rather than directly from Page, like this:

    public partial class EarmarkSearchPage : PigFinderPage 

    Remember to keep it as a partial class.

    That’s working a treat for me – I can define a bunch of custom properties and events back in ‘PigFinderPage’ and use them in all the descendants.

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

Sidebar

Related Questions

I've been researching this all morning and have decided that as a last-ditch effort,
I have decided that I really need to get some flowcharts for reverse engineering
In the end, I have decided that this isn't a problem that I particularly
I'm programming an agent-based simulation and have decided that Boost's MultiIndex is probably the
We're in the initial stages of a large project, and have decided that some
Now that I have decided upon Firebird , with the help of StackOverflow :),
I have a class that has an inner struct/class (I have decided which yet,
I have a class that had an inline member, but I later decided that
I have two panels that i wish to display to the user. I decided
I have a third-party library that is sometimes throwing an exception. So I decided

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.