Reputation: 113
<StackPanel>
<TextBox Text="" x:Name="input"/>
<Button Content="Click">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click"><!-- TextBox has to contain "ABC" to get Button Click enabled this event-->
<i:InvokeCommandAction Command="{Binding OnAdd}" CommandParameter="1"></i:InvokeCommandAction>
</i:EventTrigger>
<i:EventTrigger EventName="Click"><!-- TextBox has to contain "123" to get Button Click enabled this event-->
<i:InvokeCommandAction Command="{Binding OnAdd2}" CommandParameter="1"></i:InvokeCommandAction>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</StackPanel>
I want the <i:EventTrigger EventName="Click">
TextBox has to contain "ABC" to get Button Click enabled this event
Upvotes: 0
Views: 711
Reputation: 5885
I would suggest you do this handling within your OnAdd Command. Look especially for the CanExecute Method. This one handles if you Button will be enabled or not. You can read here how to implement this :
Upvotes: 1