本文介绍了我想自动打开Drop Down。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个下拉列表。
当我在第一个下拉列表中选择任何值之后,我想自动打开第二个下拉列表是否有解决方案。
I have two dropdown.
When i select Any value in First dropdown after that i want to open second dropdown automatically is there in solution for that.
推荐答案
<combobox name="comboBox1">
DropDownClosed="comboBox1_DropDownClosed"
SelectionChanged="comboBox1_SelectionChanged" />
And your code behind
private bool keepOpen = false;
private void comboBox1_DropDownClosed(object sender, EventArgs e)
{
new Thread(() =>
{
comboBox1.Dispatcher.Invoke(new Action(() =>
{
// do your IF logic here
if (keepOpen)
{
comboBox1.IsDropDownOpen = true;
keepOpen = false;
}
}), null);
}).Start();
}
private void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
keepOpen = true;
}</combobox>
这篇关于我想自动打开Drop Down。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!