Reputation: 68
I want to have a method fire when a button's enabled state changes, but it does not work. The method void EnableStartScan(bool isEnabled) in the view model never gets called.
<telerik:RadRibbonGroup Header="{x:Static res:StringTable.MachineCtrl}">
<telerik:RadRibbonButton x:Name="btnStart"
Text="{x:Static res:StringTable.Start}"
Size="Large"
LargeImage="/MCSP;component/Resources/Images/Button-Start.png">
<i:Interaction.Triggers>
<i:EventTrigger EventName="IsEnabledChanged">
<cal:ActionMessage MethodName="EnableStartScan">
<cal:Parameter Value="{Binding ElementName=btnStart, Path=IsEnabled}"/>
</cal:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</telerik:RadRibbonButton>
</<telerik:RadRibbonGroup>
Upvotes: 0
Views: 172
Reputation: 2706
Wy not control the state of your button in your ViewModel in the first place? Simply add a gate method in your viewModel and add trigger your other action within your viewModel
public bool CanSayHello(string name)
{
if(EvalIfEnable())
{
YourOtherMethod();
return true;
}
return false;
}
public void SayHello(string name)
{
ExecuteYourAction();
}
Upvotes: 1