Solved

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

Posted on 2015-02-03
7
823 Views
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:
xmlns:local="clr-namespace:MyApplication.ViewModels"

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,
Mike
0
Comment
Question by:thready
[X]
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
  • 4
  • 2
7 Comments
 
LVL 96

Expert Comment

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

public MyGroupViewModel()
{
}
0
 
LVL 25

Expert Comment

by:apeter
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 ?
0
 
LVL 1

Author Comment

by:thready
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?

Mike
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 25

Expert Comment

by:apeter
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.
0
 
LVL 1

Author Comment

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

Accepted Solution

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

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

to this:
DataType="local:MyGroupViewModel"
0
 
LVL 1

Author Closing Comment

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

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

724 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