Getting Started example - can't get trigger to work

Nov 12, 2011 at 4:24 AM

I have used your documentation and your video to go through my code. All seems OK. No errors on compile., used Blend to check xaml. When I press f5 and then load Products button nothing happens. If I switch MainPage back to looks at the Customer example, it works. So I seem to have all the libraries. I can't debug from inside the xaml but I have tried putting breaks in a number of the classes and it never seems to hit any of them. I am new to most of this, i have done more analysis than coding in the last few years so i am probably missing something simple. Perhaps your experience will see the obvious or give me a way to test better. Thanks.

Nov 12, 2011 at 9:40 PM
Which template are you using? Is it the one for RIA Services? If so, be sure you have all the prerequisites installed and that you can connect to the Northwind database.

Nov 13, 2011 at 3:08 AM

I am doing the first get started example which uses the SimpleMvvmSilverlight Template. If I let the MainPage.xaml reference CustomerView.xaml it works which suggests that all the pieces are in place. When I let MainPage.xaml reference ProductListView.xaml, it compiles without error, and the web page comes up showing the button and datagrid but pressing the Load Products button nothing happens. I have tried putting break points in different classes (VM, Mock service) and none of them are reached. I don't know of any way to follow step by step through the xaml. i have watched your video reviewing my code step by step and reviewing your instructions. can't find an error. the only difference I can see between the customer and product case is that one Mock uses the ViewModelDetailBase< ,> (customer) and the other uses ViewModelBase <> (product). It seems like the trigger is not connected, set up right but I am at a loss to identify what is out. I have installed all your prerequisites as well as the Northwind database even though I am not using it in this example. I noticed you have a GettingStarted project in your other examples but the product case is not done there. I like the lightness of your product and its use of builtin functionality like MEF and the Blend components. Any ideas where I might be missing something?

Nov 13, 2011 at 12:07 PM
The Load Products button should call the LoadProducts method in the ViewModel. So you should be able to set a breakpoint there. If you are not hitting that breakpoint, it means that there is a problem with the event trigger on the button. Here are a few things you can do.

1) Make sure you have installed the Blend SDK for Silverlight.
2) Make sure the DataContext of the View is bound properly to the ViewModel, which is exposed on the ViewModelLocator as a property.
3) Make sure in App.xaml you are storing the ViewModelLocator as a resource with the key of "Locator"
4) Lastly, take a look at the event trigger on the button. It should specify the Click event of the button and the LoadProducts method.

Hope this helps!