![](/img/trans.png)
[英]How to call a Button press Event even with the press of the Enter key on keyboard
[英]How to add enter key event on a button
我在这里有一个XAML按钮:
<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>
当用户点击回车键时,他必须登录到他的帐户。 如何在c#中生成按回车键事件?
将Button.IsDefault
属性设置为true然后只需处理按钮单击事件。在设置IsDefault
true后,按ENTER
将触发默认按钮的单击事件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.