Help with Debugging a WPF & Prism

Topics: Prism v4 - WPF 4
Oct 22, 2010 at 9:40 PM

Hi

I'm new to Prism and I am having a problem getting Commanding to work for me, I have a button in one region that has its Command is bound to the viewmodel, the viewmodel has a DelegateCommand setup.  When I run the app and click on the button nothing happens. I have break points setup where the code should be executing.

My question is how do I debug this ?

I don't know if when the button is clicked it the command firing?

Can someone please explain the best method for debugging problems like this

 

Thanks

Oct 24, 2010 at 3:19 PM

don't forget to wire you your viewmodel to the view in either the code behind for the view with a property something like this

 

public TheViewModelInQuestion ViewModel { set{ this.DataContext = value ;}}

or

in XAML

<YourView>

<YourView.Resources>
<YourView.DataContext>
   <vm:TheViewModelInQuestion>    <--- Defined wtih xmlns:vm = "your assembly namespace"
</YourView.DataContext>
</YourView.Resources>
</YourView>

 

One other thing that might be the cause is a misspell of your command name, you will see the error in Output tab of the debugger.

 

hth,

 

Morgan.