Unfortunately, WPF doesn’t provide a straight forward way of validating a tab page’s content before switching to a new tab, in the first version. One workaround is to listen to the TabItem’s PreviewLostKeyboardFocus event and mark it as Handled as shown below.
foreach (TabItem item in tabControl1.Items)
item.PreviewLostKeyboardFocus += new KeyboardFocusChangedEventHandler(item_PreviewLostKeyboardFocus);
void item_PreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
// sender is the TabItem.
if (this.ValidateTab() == false)
e.Handled = true;