In WPF I'm trying to clear a text box when it is disabled.
At the moment I have the following code:
<Style TargetType="{x:Type TextBox}"
BasedOn="{StaticResource stackPanelTextBoxStyle}">
<Setter Property="Text"
Value="{Binding SeatsPlusMinusAdjustmentText, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, NotifyOnValidationError=True}" />
<Style.Triggers>
<Trigger Property="TextBox.IsEnabled"
Value="false">
<Setter Property="Text"
Value="{x:Null}" />
</Trigger>
</Style.Triggers>
</Style>
Which does clear the text box just fine, but doesn't set the bound property (SeatsPlusMinusAdjustmentText
) to null.
My question is: what do I need to do to get this to set the bound property to null when the text box is cleared? Can this even be done without code-behind even handler?