tabitem

Setting style on first and last visible TabItem of TabControl

I want to set a style on the first and last TabItems in a TabControl, and have them updated as the visibility of the TabItems is changed. I can't see a way to do so with triggers. What we're after looks like this: | > > > | And the visibility of TabItems are determined by binding. I do have it working in code. On TabItem visibility...

In WPF, how do I get the content of a tabItem to fill available space?

I do not know what I am doing wrong here. In the XAML below, the Border does not fill the available space on the tabItem (just lots of whitespace). How do I fill the entire tab page? <TabControl> <TabItem Header="Plant State"> <Border Background="Red" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"></Border> </...

Focus the controls in a Tabcontrol.

How can focus the controls when select a tabitem in a tabcontrol? ...

select tabItem programmatically in WPF

Hi I have different tabItems in a TabControl and each tabItem has some input fields. I am moving between the tabItems programmatically (like a wizard to move from the first to the next) I am using this code inside the "Next" button tabItem2.isSelected = true; my problem that when I move between the tabItems by clicking on them, the ...

How Do I Change The Text Foreground of a WPF TabItem With Nested Text?

I'm looking to have the foreground of the text of a TabItem change whenever the tab becomes active. I was using the following, which was working fine until I changed the type of content being displayed in the tab: <TabControl Style="{DynamicResource SidebarTabControl}"> <TabItem Header="TabItem" Style="{DynamicResource SidebarTab}" ...

WPF - creating content for a tabitem dynamically

Hi, I'd like to set the content of a tabitem dynamically, based on the content/actions taken on previous tabitems. I'm advancing through the tabs via a command like: tabControl1.SelectedIndex++; However, the Loaded event doesn't get fired after this like I thought it would. tabControl1_SelectionChanged() is getting called, however....

WPF styling tabitem text foreground upon trigger such as IsEnabled, IsMouseOver, etc.

I'm trying to change the foreground text colour of a WPF tab item's header textblock using triggers. This works fine for most (simpler) scenarios but not when TextBlocks have been globally styled. So this simple "mouse over" trigger would work in terms of changing the foreground color: <Style x:Key="testTabItemStyle1" TargetType="{x:Ty...

Why is my TabItem custom control not showing up in the TabControl

I made a custom control called SmartTabItem, currently just the default implementation: using System.Windows; using System.Windows.Controls; namespace TestControl.Controls { public class SmartTabItem : TabItem { static SmartTabItem() { DefaultStyleKeyProperty.OverrideMetadata(typeof(SmartTabItem), ne...

WPF: hiding a tab item in a tab control thats bound to an observable collection

Heya I have a tab control bound to an observablecollection for dynamic tabs as follows: <TabControl ItemsSource="{Binding AllTabs}" SelectedIndex="{Binding SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"> <TabControl.ItemTemplate> <DataTemplate> <!--.............. --> ...

[C#/ WPF] Adjusting TabItem width automatically to fill spaces?

I have a TabControl object with some TabItem objects inside. Now the sum of width of TabItem is not long enough to fill the space on right: Now I wish to have one of following design: What properties should I set to archieve one of the design above? For the second design, I tried to adjust HorizontalAlignment property (to "center") i...

TabItem in a separate XAML

Is it possible to put a TabItem into a separate XAML and reference something like this: <TabControl> <local:MyTabItem/> </TabControl> In Separate XAML: <UserControl x:Class="MyProject.MyTabItem" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; ...

TabControl > TabItem.Header > Image Source with IsSelected Property

How do I change an image source within my TabControl > TabItem > TabItem.Header using triggers? Here's what I have so far: <TabControl Name="tabctlMainTab" Style="{StaticResource PrimaryTabControl}" SelectionChanged="MainTab_SelectionChanged" Background="Transparent"> <TabIte...

TabControl.Orientation?

I wanna set a TabControl that its header are in the left side instead of on top, how do I do that? ...

Need help with TabControl.ItemTemplate

Hello. 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 to set its template but then it creates a rectangle that contains the inner contr...

Create TabItems with differing content at runtime based on templates in WPF

Hello, I'm writing an application with WPF and part of it involves managing for the user various files which are used configure custom, in-house devices. I need to be able to manipulate different types of configurations in tabs in the same TabControl, meaning that the content of the TabItems must be dynamically generated. I'd like to d...

WPF TabItem Style with image

I have a TabControl with TabItems, The Tab Items have text and an icon. To do this I have to add a StackPanel to the TabItem. However, once I add the StackPanel I can no longer control the default style of the text. Resource: <Style TargetType="{x:Type TabItem}"> <Setter Property="Template"> <Setter.Value> <Con...

Accessing an object of a tabitem in Silverlight

Hi all. I have a Silverlight Usercontrol where I have a tabcontrol which uses a couple of tabitems. Now each tabitem is another Usercontrol. I was wondering if there is a way to access an object of one of these usercontrol tabitems. For example if I have a xaml in my main usercontrol: <controls:TabControl x:Name="TabControl" Grid.Row="...

How do I prerender the controls on a TabItem in WPF?

C# XBap Application I have a TabControl with four TabItems in it. Two of these TabItems simply contain a DataGrid from the WPFToolkit which pulls a fairly small datatable (100 rows by 4 columns) from a SQL Server database. My problem is that when I load my application and I click on one of the TabItems containing a datagrid. There se...

WPF: Center TabItems in a TabControl

Hello, in my XAML code, I have a TabControl with multiple items. The problem I have is that I can not center the tabitems about the content area. The tabs are always starting on the left side, but I need them centered. This is my code: <TabControl> <TabItem Header="Test 1" Style="{StaticResource LeftTab}" Height="40" /> <TabIt...

WPF/C#: How does one reference TabItems inside a TabControl?

I'm sure there is something simple that I am missing, but I must confess that at this point I am at a loss. I am programmatically adding TabItems to my main TabControl, one for each account that the user chooses to open. Before creating and adding a new TabItem I would like to check if the user already has the account open in another t...