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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:53:57+00:00 2026-05-17T21:53:57+00:00

I have problem with control inheritance in WPF. I created a UserControl named BaseUserControl.

  • 0

I have problem with control inheritance in WPF. I created a UserControl named BaseUserControl. I want for this control to be a base control for other WPF userControls. So I wrote another UserControl called FirstComponent. In next step I changed this code

FirstComponent : UserControl

to this

FirstComponent : BaseControl

However during compilation I get this error

Partial declarations of 'controlinheritance.componenets.FirstComponent' must not specify different base classes 

What should I do to enable FirstComponent to derive from BaseControl?

EDIT
Thanks to abhishek answer I managed to inherit controls . Howerver I have another question. In base class I specified a property public Grid _MainGrid { get; set; }. Now I want in my derived class create an instance of this grid. So I used this code

Howerver I get an error Property ‘_MainGrid’ does not have a value. Line 8 Position 36.

  • 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-05-17T21:53:58+00:00Added an answer on May 17, 2026 at 9:53 pm

    Did you see my complete article on it?

    http://www.dotnetfunda.com/articles/article832-define-base-class-for-window–usercontrol-.aspx

    I hope that would help you in this.

    If you try to execute the project, it would definitely throw error to
    you. This is because, every WPF window is created from the baseWindow
    layout rather than the current Window layout. In other words, if you
    see the XAML, you will see the root tag is Window, which is a class
    just parent of the current window.

    Thus to ensure everything works perfectly, we need to change the Root
    Element.

    So it would look like :

    <local:BaseWindow Class="BaseWindowSample.Window1" 
                      Name="winImp" 
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                      x="http://schemas.microsoft.com/winfx/2006/xaml" 
                      xmlns:local="clr-namespace:BaseWindowSample" 
                      Title="Window1">
    ...
    </local:BaseWindow>
    

    If you see this minutely, you can see I have added one namespace to my
    project and named it as local. So BaseWindow should come from
    BaseWindow and thus it goes like local:BaseWindow

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

Sidebar

Related Questions

Has anyone run into this problem... In my layout.phtml I have: <head> <?= $this->headTitle('Control
I have a problem with a data-bound DataGrid control, in that despite each column
I have a problem regarding getting the path of a user control. The scenario
I have a bit of a problem with user controls. Basically what I want
I have problem with return statment >.< I want to store all magazine names
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have a problem. I need to host grid with controls in ScrollViewer to
I have problem in some JavaScript that I am writing where the Switch statement
I have problem with starting processes in impersonated context in ASP.NET 2.0. I am
I have problem with ActionLink. I'd like to pass to my ActionLink parameter for

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.