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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:50:24+00:00 2026-05-13T06:50:24+00:00

i want to create a Window in an ControlLibrary called MyWindow so that i

  • 0

i want to create a Window in an ControlLibrary called MyWindow so that i can define a Standard Look for all my new Applications (for example i want to put an Icon in the MyWindow) and some basic logic so i can inherit from that window in other Wpf-Applications.

But if i try to inherit MyWindow in another application i get an error …

Can somebody give me a hint how i can solve this problem?


i have tow projects:
1. my ControlLib where i define a Base Window
2. A Project where i want to use my Base as the main Window

My Base Window looks like the following:

<Window x:Class="BaseWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Icon="GeoAS.ico"
Title="BaseWindow" Height="300" Width="300"
Background="black">
  <Grid>

  </Grid>
</Window>

This in the Namespace MyControllLib.
I’ve added this Lib as a reference to my Project where i want to use this Window as my Main Window.

I expected to put somthing like this is my Codebehind from the new Window:

Class Window1
Inherits MyControlLib.BaseWindow

End Class

But the compiler put out an error (i have to translate, because the error is in german):
The Baseclass of the Window1-Class has not to be different from the myControlLib.BaseWindow-Baseclass.

I have no idea whats to do

  • 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-13T06:50:25+00:00Added an answer on May 13, 2026 at 6:50 am

    Your BaseWindow class should be in pure code. Like this:

    public class BaseWindow : Window
    {
        public BaseWindow()
        {
            // Code modified here
            Uri iconUri = new Uri("pack://application:,,,/MyControlLib;component/my.ico", UriKind.RelativeOrAbsolute);
            Icon = BitmapFrame.Create(iconUri);
            Title = "BaseWindow";
            Height = 300;
            Width = 300;
            Background = Brushes.Black;
        }
    }
    

    and your derive class can be either in pure code or in xaml and code both. In first case you need to do just this:

    public partial class Window1 : BaseWindow
    {
        public Window1()
        {
            InitializeComponent();
        }
    }
    

    but in second case you need to drive your xaml also, like this:

    <local:BaseWindow x:Class="ErrorTemplatePOC.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:MyControlLib;assembly=MyControlLib">
    </local:BaseWindow>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a child window that takes up all the space of
I want to create a window based application in C# so that we can
I want to create a separate thread that runs its own window. Frankly, the
I want to create applications in windows that has complete portability (within windows OSes
I want to create a mfc window that has tabs on top. I cannot
I'm completely newbie to Qt i want to create a 800X600 window that just
I'd like to create a custom window using WPF that doesn't look like the
i am new App Developer with Titanium. i want to create a window base
I want to create a window that will be the main window and that
If I want to create a window that is not a main application window

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.