Solved

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

Posted on 2015-02-03
7
633 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
  • 4
  • 2
7 Comments
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
Does that class have a default constructor?

public MyGroupViewModel()
{
}
0
 
LVL 25

Expert Comment

by:apeter
Comment Utility
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
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 25

Expert Comment

by:apeter
Comment Utility
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
Comment Utility
Nope, it's part of the wpf project.  No duplicate class either... :-(
0
 
LVL 1

Accepted Solution

by:
thready earned 0 total points
Comment Utility
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
Comment Utility
This was the only thing that worked for me
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
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…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

728 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now