选项卡项中的 WPF XAML Web 浏览器问题

发布于 2024-09-30 14:20:21 字数 776 浏览 1 评论 0原文

我正在开发一个应用程序,其中涉及选项卡控件的选项卡项中的 Web 浏览器对象。

例子:

<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>

因此,第一次单击网络浏览器选项卡时,焦点会转到谷歌中的搜索框,当您尝试返回第一个选项卡时,需要单击两次,我认为单击一次会将焦点从网页上移开,另一个移动选定的选项卡项目?任何人都可以提供一个建议,只需单击一下即可更改选项卡吗?干杯!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

牵你手 2024-10-07 14:20:21

为 tabControl1 添加 PreviewMouseLeftButtonDown 处理程序并将 tabControl1 设置为焦点。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文