I'm trying to delete the content of a TextBox when the backspace key is pressed, but it is not working. The code:
private void txtConteudo_TextChanged(object sender, TextChangedEventArgs e)
{
if(Keyboard.IsKeyDown(Key.Back))
{
txtConteudo.Text = "";
}
}
The xaml of the textbox:
<TextBox x:Name="txtConteudo" Text="0" FontSize="16" IsReadOnly="True" Margin="10,5,16,139" TextChanged="txtConteudo_TextChanged" />