简体   繁体   中英

VB.NET for Windows Phone 8: WebBrowser Enter Button as Navigate

I have an App for Windows Phone that Use a Button to navigate the Browser to the url written in a Textbox.

Now, I want to cancel this button and use the "Enter" button in the keyboard to simulate it. How I do that?

You just need to attach an event to the TextBox. In this case it will be the KeyDown event like so :


XAML

<TextBox x:Name="MyTextBox"></TextBox>

VB

' A key has been press
Private Sub MyTextBox_KeyDown(sender As Object, e As KeyEventArgs) Handles MyTextBox.KeyDown
    ' Check to see if the key pressed was the Enter Key
    If e.Key = Key.Enter Then
        ' do whatever your button did
    End If
End Sub

Now that you have figure that out, check out all the other events you can attach to all your controls by selecting them in Design View and viewing the properties. Then click on the lightning bolt next the wrench to see all the events you can capture.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM