Question

How can focus the controls when select a tabitem in a tabcontrol?

Was it helpful?

Solution

You should capture the Selection changed event of the TabControl and inside that you focus the control you need. Just as

private void TabControl1_SelectionChanged(object sender, EventArgs e)
{
    control1.Focus();
}

OTHER TIPS

Not sure I understand what you're asking completely, but you probably want to capture the SelectionChanged event for the TabControl:


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?
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top