Focus does not fall on New Tab Item


Hello Creative team,
Whenever I add new tab item, I would like to have focus on the new Tab Item.
Can it be fixed?


adajos wrote Oct 12, 2009 at 6:20 PM

Hi CodeMaker,

FabTab does not provide any additional functionality to the base WPF TabControl in that area right now. This is because some users will want the behavior you are describing, and others will not want focus automatically set to newly-added tabs.

However, you should have the ability to do that with FabTabControl the same way you can do it with the WPF TabControl. For instance, if you are using the Items collection to populate your TabItems (rather than ItemsSource) you could have code like this in your UserControl or Window in order to immediately select a TabItem right after it is added:

public TabItemsWindow()

        this.tabControl.ItemContainerGenerator.ItemsChanged += new System.Windows.Controls.Primitives.ItemsChangedEventHandler(ItemContainerGenerator_ItemsChanged);

    void ItemContainerGenerator_ItemsChanged(object sender, System.Windows.Controls.Primitives.ItemsChangedEventArgs e)
        if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
            tabControl.SelectedIndex = tabControl.Items.Count - 1;                
Let me know if I'm missing something or misunderstanding what you are trying to do. Perhaps it would make sense to build that sort of functionality right into the FabTabControl itself, so it would just be a boolean property settable on the FabTabControl.

wrote Feb 14, 2013 at 6:36 PM