Solved

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

Posted on 2015-02-03
7
788 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
Industry Leaders: 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

Industry Leaders: 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!

Question has a verified solution.

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

Suggested Solutions

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…

730 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