防止MouseCapture WPF组合框 [英] Prevent MouseCapture WPF ComboBox

查看:93
本文介绍了防止MouseCapture WPF组合框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是标准WPF组合框,但是我注意到,如果下拉列表"为打开"并且选择了项目",则无法单击表单上的其他任何地方.

I am using a standard WPF ComboBox but I have noticed that if the Drop Down is Open and an Item is selected I am not able to click any where else on the form.

是否可以让我单击表单上的其他位置并将焦点从ComboBox移开?

Is there a way to allow me to click elsewhere on the form and move focus away from the ComboBox?

韦恩

推荐答案

韦恩

我不认识这种行为.单击组合框时,应将其关闭.

I do not recognise this behaviour. The ComboBox should close when you click away from it.

如果您可以提供代码示例,这将有所帮助.例如,尝试以下最基本的代码段:

It would help if you could provide a code example. For example, try this most basic snippet:

<Window x:Class="WpfApplication89.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>
        <ComboBox VerticalAlignment="Top" >
            <ComboBoxItem Content="one" />
            <ComboBoxItem Content="two" />
        </ComboBox>
    </Grid>
</Window>

希望有帮助,
皮特

Hope that helps,
Pete


这篇关于防止MouseCapture WPF组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆