In WPF how do I implement ICommandSource to give my custom control ability to use Command from xaml?
问题 Could you please provide a sample, of how do you implement the ICommandSource interface. As I want my UserControl , which doesn't have the ability to Specify command in xaml, to have this ability. And to be able to handle the command when user clicks on the CustomControl . 回答1: Here's an example : public partial class MyUserControl : UserControl, ICommandSource { public MyUserControl() { InitializeComponent(); } public ICommand Command { get { return (ICommand)GetValue(CommandProperty); } set