No designer after converting to 3.0

Mar 6, 2012 at 2:30 PM

I have no more designer for my windows and controls after switching to 3.0 beta. I get the following error on opening the designer:

Error    1    Type 'DataWindow' is not usable as an object element because it is not public or does not define a public parameterless constructor or a type converter.

If works at runtime though.

Coordinator
Mar 6, 2012 at 2:34 PM
Edited Mar 6, 2012 at 2:34 PM

This is fixed tonight, we are aware of this issue :)

But keep issues you find coming though!

Mar 6, 2012 at 2:35 PM

Thanks Geert! I'm looking forward to the update.

Coordinator
Mar 6, 2012 at 5:10 PM

It's live, have fun :)

http://catel.codeplex.com/releases/view/77083

Mar 7, 2012 at 8:49 AM

Now it works, thanks!

Coordinator
Mar 8, 2012 at 5:14 PM

We fixed the issue where you couldn't locatie view models in a separate assembly. Now possible with the latest beta available via nuget.

Mar 12, 2012 at 8:58 AM

Hello Geert!

this is much better, thanks! But I still have one or two issues:

1) I now removed all GetViewModelType() methods and the viewLocator.Register after switching my code in the App() to

var serviceLocator = ServiceLocator.Instance;
serviceLocator.RegisterType<IViewModelLocator, ViewModelLocator>();
serviceLocator.RegisterType<IViewLocator, ViewLocator>();

var viewModelLocator = ServiceLocator.Instance.ResolveType<IViewModelLocator>();
viewModelLocator.NamingConventions.Clear();
viewModelLocator.NamingConventions.Add("TestCatel.Control.WPF.ViewModel.[VW]ViewModel");

var viewLocator = ServiceLocator.Instance.ResolveType<IViewLocator>();
viewLocator.NamingConventions.Clear();
viewLocator.NamingConventions.Add("TestCatel.Presentation.WPF.View.[VM]Window");
viewLocator.NamingConventions.Add("TestCatel.Presentation.WPF.View.[VM]Control");

this works except for the MainWindow, where I still need the GetViewModelType().

2) I also tried the [UP] syntax like this:

viewModelLocator.NamingConventions.Add("[UP].ViewModel.[VW]ViewModel");

viewLocator.NamingConventions.Add("[UP].View.[VM]Window"); viewLocator.NamingConventions.Add("[UP].View.[VM]Control");
But this is not working. It's not really an issue though, as putting the full type at one place is acceptable, it would have just been a bit more clear/nice.

 

Coordinator
Mar 13, 2012 at 11:57 AM

You can always register a custom instance using the Register method in the locators. However, you are probably not following a naming convention or register the ViewModelLocator too late (but I see that you register it in the constructor of the App class).

Maybe you can take a look at the examples and see how they solve this issue. See http://catelexamples.codeplex.com.