tags:

views:

141

answers:

1

Hey,

Where should I store event methods for button Click event ?Normally it's store in code behind of wpf page,

<Button Name="myButton" Click="myButton_Click">Click Me</Button>

but in MVVM it should be store in other view-model class and bind to click property of button like that??

<Button Name="myButton" Click="{Binding StaticResouces myButton_Click}">Click Me</Button>
+3  A: 

Use commands. Your VM exposes the command and the button binds to it:

<Button Command="{Binding SomeCommand}">Do It!</Button>

See my blog post on delegate commands and active aware commands for the specifics on how you can implement custom commands.

HTH,
Kent

Kent Boogaart
Thanks for advice ;) I read Your post and also more info on the net, hope that this solve my problem :)
netmajor