![](/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.