I have a button in XAML here:
<Button Content="Login" x:Name="loginButton" Grid.Row="7" Grid.Column="3"
Margin="200,30,0,0" Grid.RowSpan="2" Height="50" Width="150"
VertialAlignment="Top" Click="loginButton_Click" ClickMode="Press"
FontSize="24" FontFamily="Calibri" Style="{StaticResource AlbaabButtonStyle}">
</Button>
When user hits the enter key, he must be logged in to his account. How do I generate a press enter key event in c#?
将Button.IsDefault
属性设置为true然后只需处理按钮单击事件。在设置IsDefault
true后,按ENTER
将触发默认按钮的单击事件。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.