Hi - I'm trying to set the active tab on the Tabs component. I tried using .selectedIndex but that only sets the initial tab. It works in code as long as the user has not clicked a tab. If the user clicks on a tab, changing the .selectedIndex property is no longer picked up by the Tabs component. Any idea how I can set the active tab using code?
The SelectedIndex property should be used indeed. You however need to keep it in sync with the TabStrip state. Here is an example.
- Create a page property and set it to 0.
- Set the SelectedIndex property of the Tabs to that page property.
- Handle the Change event of the Tabs to sync the page property with the currently selected tab index.
- Update the property (for example from the click event of a button) to set the current selection.
Here is how it works.
Works like a charm - thank you!!!