I have a TextBox Bound to a Double type variable.
<TextBox Text="{Binding Path=OldRegCost,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Grid.Row="0" Grid.Column="1" Height="25" Width="50" Margin="10,0,10,0"></TextBox>
In the code behind i binded the textbox to a Double type variable.
private Double? _OldRegCost;
public Double? OldRegCost
{
get { return _OldRegCost; }
set
{
OldRegCost = value;
RaisePropertyChanged("OldRegCost");
}
}
When the user try to enter a symbol (@,#,$,%,& etc) the TextBox automatically turns RED colour.
It also trims the entered special character.
Since am doing a separate validation using Regex in code behind:
1) Is there any way in code behind to know whether the text field turned RED (an invalid character entered)
2) or can i remove the RED effect and get the entire text (with invalid character) to code behind.
Please give me a solution