Keep text box in sync with browser location [closed]

一笑奈何 提交于 2019-12-13 07:41:03

问题


I'm creating a web browser app and would like textbox2 (url address bar) to be in sync with webBrowser1 (web page display) so that what ever the user clicks on the page the address will appear in the box.


回答1:


You could bind textbox2.Text to webBrowser1.Source, as follows:

<TextBox x:Name="textbox2" Text="{Binding ElementName=webBrowser1, Path=Source}" />
<WebBrowser Height="160" Width="160" x:Name="webBrowser1"/>

That way, when the user changes the text in textBox2, the web browser will also update the page it's pointing to.



来源:https://stackoverflow.com/questions/13962763/keep-text-box-in-sync-with-browser-location

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!