How to programmatically select a TabItem in WPF TabControl

As @Chris says, any of the first three things should work and as @Phyxx says, it doesn’t always really work. The problem is some subtle thing about the order of property changes. To work around it you need to let the WPF invoke your tab-selection code in its own time:

Dispatcher.BeginInvoke((Action)(() => MyTabControl.SelectedIndex = x));

This does just what Phyxx’ timer does, but in a slightly less extreme way.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)