I want to lock my wpf tab to change the index but I'm getting dispatcher error messages with my code below. Where am I doing wrong? I'm aware that once the content changes, it fires the same event but is there any other event to fire for this ?
private void MainTabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!(e.Source is TabControl))
return;
if (Helper.GetProperty<bool>("IsTabLocked")) // my condition
{
MessageBox.Show("tab is locked");
e.Handled = true;
return;
}