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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:09:49+00:00 2026-05-14T14:09:49+00:00

I placed a control into a grid. let’s say the control is derived from

  • 0

I placed a control into a grid. let’s say the control is derived from public class ‘ButBase’ which is derived in its turn from System.Windows.Controls.Button. The code normally compiles and app works just fine. But there’s something really annoying.

When you try to switch to xaml-design tab it will say ‘The document root element is not supported by the visual designer’, which is normal and I’m totally okay with that, but the thing is, that all the xaml code is underlined and VS2010 says: ‘Cannot create an instance of ButBase’ although still normally compiles and able to run.

I’ve tried the same code in VS2008, it said that needs to see a public parameterless constructor in the ButBase, and even after I put one it showed the same error.

What do I miss here?

  • 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-14T14:09:49+00:00Added an answer on May 14, 2026 at 2:09 pm

    Make sure ButBase is not abstract. Designer does not like those.

    Also make sure not to do any funny business in your constructor, Initialized and Loaded handlers. Funny includes any non-trivial tasks, such as connecting to a database or anything else that might interfere with the designer. Any such code should be wrapped with a designer-check. There are a number of ways out there to check for a presence of designer but I have found the following to work ok:

    internal static class DesignModeChecker
    {
        private static bool? _isInDesignModePriv;
    
        public static bool IsInDesignMode
        {
            get
            {
                if (!_isInDesignModePriv.HasValue)
                {
                    _isInDesignModePriv = Process.GetCurrentProcess().ProcessName.ToLower().Trim() == "devenv" && !Debugger.IsAttached;
                }
    
                return _isInDesignModePriv.Value;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to know how to add a user control into a window from
I'm creating my own very basic Grid control. I've decided to derive from ScrollableControl
I'm building a project that loads data from a webservice into a TreeView Control.
I have a User Control which is dynamically placed by CodeBehind as follows: Dim
I'm working with an ActiveX control placed on a winform. I'd when the user
Well i have a control thats placed in a usercontrol and it exposes a
When I place a control on a tabpage in Silverlight the control is placed
I have user control in my MVC2 app placed in the Content folder (it's
I have a custom user control that contains asp:ValidationSummary . It is placed on
I am using Ajax tab container control with 3 tabs. I have placed a

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.