Need help handling events of a DataTemplate in the Application.xaml file
问题 I have in my application a data template that has a few buttons. I want those buttons' even handler to be fired in the current page (I am using this template in many pages) rather than in the Application.xaml.vb/cs file, since I want different actions on each page. I hope I am clear. 回答1: You can use commanding to achieve this. Have the Button s in the DataTemplate execute specific Command s: <Button Command="{x:Static MyCommands.SomeCommand}"/> Then have each view that uses that DataTemplate