我想在一个单独的类中实现 ICommand,并想从这里访问按钮:
<Grid>
<Button Command="{StaticResource Do}" >Do!</Button>
</Grid>
public class DoCommand : ICommand
{
public void Execute(object parameter)
{
**I need to access a xaml that triggered this command from here**
}
public bool CanExecute(object parameter)
{
return true;
}
public event EventHandler CanExecuteChanged;
}
我怎么能那样做?谢谢。