Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1107
  • Last Modified:

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

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
thready
Asked:
thready
  • 4
  • 2
1 Solution
 
Bob LearnedCommented:
Does that class have a default constructor?

public MyGroupViewModel()
{
}
0
 
apeterCommented:
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
 
threadyAuthor Commented:
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
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
apeterCommented:
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
 
threadyAuthor Commented:
Nope, it's part of the wpf project.  No duplicate class either... :-(
0
 
threadyAuthor Commented:
I was finally able to fix this by changing

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

to this:
DataType="local:MyGroupViewModel"
0
 
threadyAuthor Commented:
This was the only thing that worked for me
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now