Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

WPF - The Design view cannot display correctly because some custom elements have not yet been built.

Posted on 2015-02-03
Last Modified: 2015-02-13
Hi Experts,
I've got a working WPF application that has this error from my xaml file.  

I have one warning in the xaml that I think is the cause:
DataType="{x:Type local:MyGroupViewModel}"

The namespace I imported at the top is the following:

MyGroupViewModel most definitely is part of the MyApplication.ViewModels (otherwise the app wouldn't work).  This class has a default constructor, however, it's default constructor does have a base-class initializer like so:
public MyGroupViewModel () : base(null, true) { }

Is the problem potentially the call to base?  What else could I be missing?

Thank you,
Question by:thready
  • 4
  • 2
LVL 96

Expert Comment

by:Bob Learned
ID: 40588784
Does that class have a default constructor?

public MyGroupViewModel()
LVL 25

Expert Comment

ID: 40590104
Syntax wise it looks okie but why u want to pass null,true always. Instead you have avoid this and hard code null and true in your base class.

for testing wise..if you remove the base initialization, is the application working ?

what exactly is your error message ?

Author Comment

ID: 40590264
It does have a default constructor - wouldn't the following be considered a default constructor?
public MyGroupViewModel () : base(null, true) { }

In any case - I removed the need to call the base constructor and now it's just public MyGroupViewModel() {}

The warning I'm getting the the xaml file is:
"The name "MyGroupViewModel" does not exist in the namespace "clr-namespace:MyApplication.ViewModels"

But it does.  Or it wouldn't work right?

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

LVL 25

Expert Comment

ID: 40592465
is the view model coming from a referenced dll ? then you need to specify the assembly name.

And hope there is no duplicate class you have.

Author Comment

ID: 40592483
Nope, it's part of the wpf project.  No duplicate class either... :-(

Accepted Solution

thready earned 0 total points
ID: 40597327
I was finally able to fix this by changing

DataType="{x:Type local:MyGroupViewModel}"

to this:

Author Closing Comment

ID: 40607525
This was the only thing that worked for me

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C# Gridview 1 47
MailAddress in vb 4 29
LINQ Select all records by MAX data syntax help 1 17
How to repeat the data 4 17
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question