public event GenericCommand.CommandExecutedEventHander CommandExecuted
public event GenericCommand.CommandExecutedEventHander CommandExecuted
private GenericCommand mBasicCommand; public GenericCommand BasicCommand { get { return mBasicCommand == null ? mBasicCommand = new GenericCommand("BASICCOMMAND", doBasicCommandLogic) : mBasicCommand; } } private void doBasicCommandLogic(object sender, string parameter) { //Logic to execute when the command is selected. //The "parameter" argument will be loaded with any data defined in the XAML using the CommandParameter property. string tmpSynergyStore = ((Part_Data)((GenericCommand)sender).HostDataContext).SynergyRecord; }
<Grid Opacity="0"> <Button Command="{Binding Path=BasicCommand}" CommandParameter="DataPasedToMethod">Click me</Button> </Grid>
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2