c# - 组合框 isEditablelostFocus 在获得焦点时调用

标签 c# wpf combobox

我有一个可编辑的组合框,每当您单击它时,就会调用lostFocus 方法。当它实际失去焦点时也会调用它。
当我单击组合框时,是什么导致 LostFocus 运行?

<ComboBox IsEditable="True" IsReadOnly="False"
                  Text="{Binding Model.Number}" ItemsSource="{Binding Item}"
                  SelectedItem="{Binding Model.Number}"    
                  VerticalAlignment="Top">
    <dxmvvm:Interaction.Behaviors>
        <dxmvvm:EventToCommand EventName="LostFocus" Command="{Binding TeethLostFocusCommand}" />
    </dxmvvm:Interaction.Behaviors>
</ComboBox>

最佳答案

What is causing the LostFocus to run when I click on the combobox?

LostFocus 是一个路由事件:https://msdn.microsoft.com/en-us/library/ms742806%28v=vs.110%29.aspx

这意味着当 ComboBox 的任何子元素(包括属于其 ControlTemplate 的任何元素)丢失时,您的事件处理程序也会被调用重点。

有关详细信息,请参阅以下链接:https://social.msdn.microsoft.com/Forums/vstudio/en-US/7c3ed7d5-c550-4e51-bcb6-32f2b3d0ecf7/focus-issues-with-editable-combobox?forum=wpf

关于c# - 组合框 isEditablelostFocus 在获得焦点时调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42210227/

相关文章:

c# - WPF 工具包数据网格 : Sorting with Null Values

mysql - 在 vb.net 中将 mysql 数据库表显示到 datagridview 中

combobox - 如何使 DBLookupComboBox 鼠标滚轮工作

c# - 使用 int 键时输入字符串的格式错误

c# - Parallel.ForEach() 与 foreach(IEnumerable<T>.AsParallel())

c# - 在运行时创建 LINQ 查询到 EntityFramework 中的 GroupBy(具有继承)

jquery - 使用 css 和 jquery 样式(突出显示/粗体)组合/选择框中的一组元素

c# - 将变量值后面的代码传递给 jQuery 函数

wpf - 通过 XAML 中的样式 && 触发器绑定(bind)窗口标题

c# WPF App.Current 在自定义对话框窗口关闭后变为空