0
在tabcontrol中選擇tabitem時如何聚焦控件?將控件集中在Tabcontrol中
在tabcontrol中選擇tabitem時如何聚焦控件?將控件集中在Tabcontrol中
你應該抓住的TabControl的選擇改變事件裏面,你關注你需要的控制。就像
private void TabControl1_SelectionChanged(object sender, EventArgs e)
{
control1.Focus();
}
不知道我理解你的要求完全,但你可能要捕獲的的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?
}