Combobox没有正确的焦点作为例外后设置Combobox.Fous() [英] Combobox is not having proper focus as excepted After setting Combobox.Fous()
问题描述
大家好,
我有以下代码
公共部分类配置:UserControl
{
public Configuration()
{
InitializeComponent();
this。已加载+ =新RoutedEventHandler(Configuration_Loaded);
}
void Configuration_Loaded(对象发送者,RoutedEventArgs e)
{
combobox.Focus();
}
}
加载usercontrol时,我想将焦点设置为组合框。我在代码中做了同样的事情。但问题是,像文本框一样,我们看不到专注于组合框。是wpf控制的bug吗?
提前谢谢
Hi All,
I have following code
public partial class Configuration : UserControl
{
public Configuration()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(Configuration_Loaded);
}
void Configuration_Loaded(object sender, RoutedEventArgs e)
{
combobox.Focus();
}
}
When usercontrol is loaded i want to set focus to combobox. I did same in the code. but problem is that like textbox we can not see focus on combobox. Is it bug of wpf control ?
Thanks in advance
推荐答案
我不知道你到底想要什么,不过通过阅读你的代码
- 正常工作btw -
我猜你想在组合框上放一个不同的外观,当它聚焦时。
您可以使用FocusVisualStyle
-Property来实现此目的。
I don't know what exactly you want, however by reading your code
- which works properly btw -
I guess you want to put a different look on the combobox, when it's focused.
You can achieve this, by using theFocusVisualStyle
-Property.
public partial class Configuration : UserControl
{
public Configuration()
{
InitializeComponent();
combobox.Focus();
}
}
combobox name should be give 1
公共部分类配置:UserControl
{
公共配置()
{
InitializeComponent();
combobox.Focus();
}
}
组合框标签索引应该是1
public partial class Configuration : UserControl
{
public Configuration()
{
InitializeComponent();
combobox.Focus();
}
}
combobox Tab Index should be give 1
这篇关于Combobox没有正确的焦点作为例外后设置Combobox.Fous()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!