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 8725655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:05:08+00:00 2026-06-13T08:05:08+00:00

I am using WPF and I’m trying to make a class inherit from UserControl

  • 0

I am using WPF and I’m trying to make a class inherit from UserControl and use that class as a base class for other classes. I’ve read numerous articles on how to do this (such as this one which has over 50 upvotes), but they all say the same thing and none of them work.

I have this code:

namespace MyNamespace {
    // handwritten
    public class BaseControl : UserControl { }

    // generated by the IDE
    public partial class XAMLControl1 : UserControl {
        ...
    }
}

Now, I change that line to

public partial class XAMLControl1 : BaseControl {

And in the XAML, I change it from

<UserControl x:Class="MyNamespace.XAMLControl1" ...>
    ...
</UserControl>

To

<my:BaseControl x:Class="MyNamespace.XAMLControl1"
                xmlns:my="clr-namespace:MyNamespace" ...>
    ...
</my:BaseControl>

The my:BaseControl part is underlined in squiggly blue, so when I hover it, IntelliSense says

The name "BaseControl" does not exist in the namespace "clr-namespace:MyNamespace".

And the compiler gives me the strange errors

  1. Closing tag for element ‘<m>’ was not found.

  2. The type ‘m‘ was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

  3. The name "BaseControl" does not exist in the namespace "clr-namespace:MyNamespace".

Yes, that’s "The type ‘m‘ was not found". I don’t see where I’m trying to use a type named m anywhere. I think this is an unrelated compiler bug, but I thought I’d mention it. And also I’m definitely sure the type BaseControl does exist in the namespace MyNamespace. Intellisense comes up with no suggestions after I type the my:.

What can I do to fix this problem? I am using Visual Studio 2012 Express for Windows Desktop (7).

  • 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-13T08:05:10+00:00Added an answer on June 13, 2026 at 8:05 am

    Its seems that you have to use your own BaseControl using separate dll. When you start your xaml file, you start to use the my namespace, and you declare it later in your xaml. It is the same if you want to use StaticResource before it was declared. But when you separate your BaseControl to another project to get a new dll, it will be compiled before it used.

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

Sidebar

Related Questions

Im using WPF which has a Storyboard class that has a Completed event. I
Using WPF and Prism. I have a view, containing 1 textblock <UserControl x:Class=ArmoryModule.Views.ResultsView xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
(Using WPF) In a small application that I wrote, I am using some count-down
I am using wpf framework 3.5 for this I had to use winworms ->
I'm using WPF I would like that my windows take the entire screen of
I have been using WPF for a new project which is far from done.
I am using WPF and OpenTk and I have a GLControl that is set
I am using WPF datagrid. Can I retrieve rows from datagrid using Linq. Something
I am using WPF and an MVVM pattern. All the comboboxes that are bound
Using WPF, I have a TreeView control that I want to set its ItemTemplate

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.