开发者

WPF XAML Web Browser in Tab Item issue

I am developing an application that involves a web browser object in a tab item of a tab control.

example:

<Window x:Class="TabControl.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
<Grid>
    <TabControl
            x:Name="tabControl1">
        <TabItem>
            <TextBox>Hello</TextBox>
        </TabItem>
        <TabItem>
            <WebBrowser Source="http://www.google.com"></WebBrowser>
        </TabItem>
    </TabControl>
</Grid>

So, the first time you click on the web browser tab, the focus goes to the search box in google, when you try to go back to the first tab, it requires two clicks, one i assume to take the focus away from the webpage, and another开发者_如何学运维 to move the selected tab item? Can anyone offer a suggestion that would enable the tab to be changed with only one click? Cheers!


Add a PreviewMouseLeftButtonDown handler for tabControl1 and set tabControl1 to focus.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜