i had a functionality that in text box after entering a value when i pressed enter the value was validated.
Now i wanted to perform similar task by using enter button.
I had created an event for button click but not able to understand how to perform enter action.
i am sending code:
<Button x:Name="BtnCancel" Content="CANCEL" Style="{StaticResource ButtonStyle10}" VerticalAlignment="Center" Click="PlayerSwipeBtn_Click" Width="110" Height="55" Margin="303,6,113,4" HorizontalAlignment="Center" Grid.Row="2" Grid.RowSpan="2" />
<Button x:Name="BtnEntername" Content="Enter" Style="{StaticResource ButtonStyle10}" VerticalAlignment="Stretch" Width="110" Height="55" Margin="113,6,303,4" HorizontalAlignment="Center" Grid.Row="2" Grid.RowSpan="2" Click="BtnEntername_Click" />
Xaml.cs code:
private void PlayerSwipeBtn_Click(object sender, RoutedEventArgs e)
{
Button btnAction = (Button)sender;
ACTION = btnAction.Tag.ToString();
if (ACTION == PLAYER_ACTIONS_CODE.CANCEL)
this.DialogResult = false;
else
this.DialogResult = true;
}
what to do for enter button to validate entry.
Below might help you. KeyCode for enter key is “13”, you can modify and perform your logic to the below code.