在tabcontrol中选择tabitem时如何关注控件?
答案 0 :(得分:1)
我不确定我完全理解您的要求,但您可能想捕获TabControl的SelectionChanged事件:
public Window1()
{
InitializeComponent();
TabControl1.SelectionChanged += TabControl1_SelectionChanged;
}
private void TabControl1_SelectionChanged(object sender, EventArgs e)
{
TabItem item = (TabItem)TabControl1.SelectedItem;
// Find the first control in the TabItem content and focus it?
}
答案 1 :(得分:1)
您应该捕获TabControl的Selection更改事件,并在其中集中您需要的控件。就像
一样private void TabControl1_SelectionChanged(object sender, EventArgs e)
{
control1.Focus();
}