简体   繁体   English

Windows Phone 8的VB.NET:WebBrowser输入按钮为导航

[英]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. 我有一个适用于Windows Phone的应用程序,该应用程序使用按钮将浏览器导航到在文本框中编写的url。

Now, I want to cancel this button and use the "Enter" button in the keyboard to simulate it. 现在,我要取消此按钮,并使用键盘上的“ Enter”按钮进行模拟。 How I do that? 我该怎么做?

You just need to attach an event to the TextBox. 您只需要将一个事件附加到TextBox。 In this case it will be the KeyDown event like so : 在这种情况下,它将是KeyDown事件,如下所示:


XAML XAML

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

VB 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. 然后,单击扳手旁边的闪电,以查看可以捕获的所有事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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