gpt4 book ai didi

c# - 组合框输入事件 WPF

转载 作者:行者123 更新时间:2023-11-30 14:01:31 24 4
gpt4 key购买 nike

每当在组合框中按下 Enter 时,我都需要触发一个事件。这是一个 WPF C# 4.0 控件,我无法找到一个特定的事件处理程序来执行此操作。我想我遗漏了一些东西,因为这似乎应该包括在内。是否有预先存在的代码来完成此任务?

我也试过:

private void comboBox1_SelectionChanged(
object sender,
SelectionChangedEventArgs e)
{
if (e.Equals(Key.Enter))
{
// Do Something
}
}

最佳答案

 private void comboBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Return)
{
// do stuff
}
else
{

// do stuff
}
}

关于c# - 组合框输入事件 WPF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8066333/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com