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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:29:55+00:00 2026-05-25T09:29:55+00:00

In design time I have a couple of false errors that seems to be

  • 0

In design time I have a couple of false errors that seems to be caused by WPF not being able to estimate the value of things without actually running them. This of course works flawlessly in run time.
The question is how do I get rid of these errors?

Here is one example:

I have in a class the following two:

public static bool IsHubb {get; set;} 
public static bool IsEC { get { return !IsHubb; } }

The following convertor works perfectly well:

   public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        if (HubbCostOfferPage.IsHubb && HubbCostOfferPage.CarObj.TestApprovedDate == null)
            return Visibility.Visible;
        else
            return Visibility.Collapsed;
    }

The following however (although very similar) gives an “Object reference not set to an instance of an object.” error, which means the only thing I can see on design time without commenting out the StaticResource definition is a big error:

public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
    if (HubbCostOfferPage.IsEC == true && HubbCostOfferPage.CarObj.TestApprovedDate == null)
        return Visibility.Visible;
    else
        return Visibility.Collapsed;
}

If I replace HubbCostOfferPage.IsEC with HubbCostOfferPage.IsHubb, all works fine so I know that there is where the problem is.

If I replace HubbCostOfferPage.IsEC with !HubbCostOfferPage.IsHubb in the convertor, I get the same problem. The designer seems to complain because it can’t evaluate “!” during design time.

Any ideas how to make this work in design time as well?

  • 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-25T09:29:56+00:00Added an answer on May 25, 2026 at 9:29 am

    Based on Pauls Answer I would suggest not to check is CarObj is null, because during runtime the exception shall be thrown.

    I suggest to change your converter as follows:

    public object Convert(object value, Type targetType, object parameter,  
      System.Globalization.CultureInfo culture)  
    {  
      if (ApplicationIsInDesignMode) { return Visibility.**WHATEVER YOU LIKE ***; }
      if (HubbCostOfferPage.IsEC == true && HubbCostOfferPage.CarObj.TestApprovedDate == null)
        return Visibility.Visible;
    else
        return Visibility.Collapsed;
    }
    
    private static bool ApplicationIsInDesignMode
        {
            get { return (bool)(DesignerProperties.IsInDesignModeProperty.GetMetadata(typeof(DependencyObject)).DefaultValue); }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have numerous functions (unknown at design time) that each take a specific number
I have a couple of design/architectural questions that always come up in our shop.
I have an UserControl and would like to hide the resizing handles in design-time,
I have tough time making this design decision. I could go with traditional new
I got the following Design time exception for my control in WPF System.NotImplementedException The
My question is related to the design-time support of WPF. From MSDN I read,
We have a couple of very very slow JUnit tests that make heavy use
In the case of responsive css design, let's assume you have a couple of
I have been using State machine based design tools for some time, and have
Now that I am learning more about design time aspects of component development, I

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.