User Interface control in C# with WPF Framework that represents a selectable item inside a TabControl.
Questions tagged [tabitem]
454 questions
77
votes
4 answers
How do I bind a TabControl to a collection of ViewModels?
Basically I have in my MainViewModel.cs:
ObservableCollection MyTabs { get; private set; }
However, I need to somehow be able to not only create the tabs, but have the tabs content be loaded and linked to their appropriate viewmodels while…

michael
- 14,844
- 28
- 89
- 177
62
votes
4 answers
In C# WPF, why is my TabControl's SelectionChanged event firing too often?
I have a tabbed GUI with each tab containing a Frame. In one of these Frames there is a DataGrid. When the user selects this tab, I need my datagrid sorted, so I'm using the TabControl SelectionChanged event to trigger the sort. However, this event…

Anders
- 1,401
- 3
- 16
- 20
53
votes
9 answers
How to programmatically select a TabItem in WPF TabControl
I would like to know how to select a specific TabItem in a WPF TabControl.
I tried these bellow but nothing work!
MyTabControl.SelectedIndex = x
MyTabControl.SelectedItem = MyTabItem
MyTabControl.SelectedValue = MyTabItem
MyTabItem.IsSelected =…

Pierre Toutant
- 531
- 1
- 4
- 3
27
votes
4 answers
How to remove the default margin on the content of a TabItem?
I'm using the TabControl class in WPF and I've noticed that the content of each TabItem has a default margin of 4 pixels on all sides.
Sample code:

Mal Ross
- 4,551
- 4
- 34
- 46
24
votes
1 answer
TabControl.ItemTemplate: set TabItem.Header.Text to a MultiBinding with StringFormat
How do I set the TabItem.Header to bindings taken from few fields, each binding shown in a different size, all in the place of the original header text; without overriding the default style and behavior of the header - I only need the text.
I tried…

Shimmy Weitzhandler
- 101,809
- 122
- 424
- 632
21
votes
3 answers
Changing the text color of the selected tabItem in a TabControl?
In the second code there is a textBlock with the text "Mina övningar"
How can I change the text color to black when the tabItem is selected?
style: