Alex
Alex

Reputation: 312

IsEnabled binding broken when adding an EventTrigger

I have this TextBox that is disabled when a CheckBox is ticked, using a binding on IsEnabled. This works fine on its own.

<TextBox Text="{MyValue}" IsEnabled="{Binding CheckBoxTicked}" />
<CheckBox IsChecked="{Binding CheckBoxTicked, Converter={StaticResource BoolInverterConverter}}"  />

I want to add a LostFocus event to this TextBox that will check if the value is correct using a command in the ViewModel.

<i:Interaction.Triggers>
    <i:EventTrigger EventName="LostFocus">
        <prism:InvokeCommandAction Command="{Binding LostFocusCommand}" />
    </i:EventTrigger>
</i:Interaction.Triggers>

This works too, but the IsEnabled binding gets broken when the trigger is added and the TextBox no longer reacts to the ticking of the CheckBox.

Things I tried :

Upvotes: 1

Views: 336

Answers (1)

mm8
mm8

Reputation: 169400

Try to remove the converter or replace <prism:InvokeCommandAction ... /> with <i:InvokeCommandAction ... />. Then it should work.

Upvotes: 5

Related Questions