Step : 1 - Create new command as a DepenedecyProperty and implement it
Steo : 2 - Bind Command property in the button the the MyButtonCommandProperty in your UserControl.
public Class YourUserControl: UserControl
{
public YourUserControl()
{
MyButtonCommad = new RelayCommand
(
() => {
() => { return true ;}
);
}
public bool MyButtonCommad
{
get { return (ICommand)GetValue(MyButtonCommandProperty ); }
set { SetValue(MyButtonCommandProperty , value); }
}
public static readonly DependencyProperty MyButtonCommandProperty =
DependencyProperty.Register("MyButtonCommad ", typeof(ICommand),new FrameworkPropertyMetadata(null));
}
<Window>
<StackPanel>
<Button Command={Binding ElementName=control1,Path=MyButtonCommad ,Mode=OneWay/>
<YourUserControl: x:Name="control1" />
</StackPanel>
</Window>