Problems using base template

Oct 6, 2012 at 4:23 PM

I used the base template to create a new project but have run into some issues. The first is a simple fix in the MainWindow.xaml I was trying to figure out why the banner was working and found that the DataContext path reference contained square brackets. Removing the square brackets fixed that.

I also have an error in the MainWindow.xaml:

Error 2 Cannot add instance of type 'CallMethodAction' to a collection of type 'TriggerActionCollection'. Only items of type 'T' are allowed. C:\Projects\MyProject\Myproject.Wpf\MainWindow.xaml 9 9 MyProject.Wpf

At this point, I have to believe there is a reference somewhere that is incorrect since I can move my View and MainWindow xaml files to my original demo solution and do not see this error. This error does not prevent the solution from compiling and running, it only prevents the designer from rendering my view in the main window. I have reviewed all references between the working and non-working projects and they seem identical with the exception that in the working project I included the model in the wpf project and in the non-working project the model is a separate project.

I can get rid of this error by commenting out body of any buttons that look like this:

            <Button Margin="5,5,5,5" Width="Auto" 
              Height="26" Content="Begin">
                    <i:EventTrigger EventName="Click">

If I comment out the interactions the MainWindow.xaml renders fine. Even though the designer won't render, the interactions work when I run the project. The primary difference I can see between the projects was caused by the way I built them. The first project, which works, was created using the simplemvvm project template and I used nuget to add the entity framework. The second was created using the simplemvvm project template. I then created a model project and used nuget to add references to simplemvvm (to pick up basemodel) and entityframework.

I am not familiar enough with the history WPF and SimpleMvvmToolkit to know what is causing this designer failure. I have done a lot of testing to eliminate differences between my working and non-working projects and I can't see where the problem is. I am using the .Net 4.5 framework for all of these projects and VS2012. Can you give me any suggestions on what could be causing this error?

On a side note, I notice a lot of chatter between the view and viewmodel that I think may be caused by property change events. What would be the possible side effects of testing for differences before firing the NotifyPropertyChanged events?

--David Morris

Oct 7, 2012 at 6:40 PM

I ended up rebuilding the project from the working project and the cannot add CallMethodAction to a TriggerActionMethod error is gone but I have no idea why the designer didn't like the project.