tabitem

WPF: Center TabItems in a TabControl

人盡茶涼 提交于 2019-11-30 11:28:15
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" /> <TabItem Header="Test 2" Style="{StaticResource MiddleTab}" /> <TabItem Header="Test 3" Style="{StaticResource MiddleTab}" /> <TabItem Header="Test 4" Style="{StaticResource RightTab}" /> </TabControl> I do not know a property to center the items - any idea? Internally, the TabControl

TabControl.ItemTemplate: set TabItem.Header.Text to a MultiBinding with StringFormat

杀马特。学长 韩版系。学妹 提交于 2019-11-30 08:04:31
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 controls, and this rectangle is not responsive for user clicks, and also have the control-style, I want this controls to be invisible, only its text should be visible. I've tried the following: <TabControl ItemsSource="{Binding}"> <TabControl.ItemTemplate> <DataTemplate>

Binding to ItemsSource of TabControl in WPF

佐手、 提交于 2019-11-30 07:42:18
问题 I am trying to create a User Control that represents what I am calling a workspace (a reference from a blog by Josh Smith). The workspaces will be displayed in a tab control. I am aiming to use a tabbed interface to manage various documents that I have open much like in a browser of an excal work book. Each time a user opens a new workspace, that workspace should be displayed in the tab control. Each Workspace takes the form of a user control, and each workspace has its own view model. I

WPF: Center TabItems in a TabControl

不打扰是莪最后的温柔 提交于 2019-11-29 17:37:55
问题 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" /> <TabItem Header="Test 2" Style="{StaticResource MiddleTab}" /> <TabItem Header="Test 3" Style="{StaticResource MiddleTab}" /> <TabItem Header="Test 4" Style="{StaticResource RightTab

RelativeSource in DataTemplate works with TabControl but not with TabItem

删除回忆录丶 提交于 2019-11-29 15:10:36
I am having a TabControl and within it a TabItem having a ContentControl. This ContentControl is applied a datatemplate. The code is here: <TabControl x:Name="tabControl1" Tag="Giving URI here works"> <TabItem x:Name="tabItem1" Tag="Giving URI here doesnt work"> <ContentControl ContentTemplate="{StaticResource myOptionsDataTemplate}"> <StackPanel> <TextBlock Text="Some Text" /> </StackPanel> </ContentControl> </TabItem> </TabControl> And the data template is: <DataTemplate x:Key="myOptionsDataTemplate"> <Border> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height

TabControl.ItemTemplate: set TabItem.Header.Text to a MultiBinding with StringFormat

你说的曾经没有我的故事 提交于 2019-11-29 10:59:05
问题 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 controls, and this rectangle is not responsive for user clicks, and also have the control-style, I want this controls to be invisible, only its text should be visible. I've

WPF - Overlapping Custom Tabs in a TabControl and ZIndex

无人久伴 提交于 2019-11-29 06:33:17
Problem I have a custom tab control using Chrome-shaped tabs that binds to a ViewModel. Because of the shape, the edges overlap a bit. I have a function that sets the tabItem's ZIndex on TabControl_SelectionChanged which works fine for selecting tabs, and dragging/dropping tabs, however when I Add or Close a tab via a Relay Command I am getting unusual results. Does anyone have any ideas? Default view: Removing Tabs: Adding 2 or more Tabs in a row: Adding more then 1 tab at a time will not reset the zindex of other recently-added tabs so they go behind the tab on the Right, and closing tabs

ListBox in TabControl scrolling issue

孤者浪人 提交于 2019-11-28 12:50:22
I have an issue with WPF ListBox in TabControl. ListBox resets it's scrollbar position to 0 when I change tabs. Here is repro code: <TabControl x:Name="_tabs"> <TabItem Header="1"> <ListBox ItemsSource="{Binding}" ScrollViewer.VerticalScrollBarVisibility="Auto"/> </TabItem> <TabItem Header="2"> <ListBox ItemsSource="{Binding}" ScrollViewer.VerticalScrollBarVisibility="Auto"/> </TabItem> </TabControl> _tabs.DataContext = Enumerable.Range(1, 300).ToArray(); When the window opens I open the second tab, scroll list somewhere to the middle, return to the first tab and then open the second again.

Using a datatemplate for the TabItems in a tabControl

本小妞迷上赌 提交于 2019-11-28 11:52:41
问题 If I have a class called: GuiObject, and that class has a list of GuiObjects called: "GuiObjects". Now say my window has a list of GuiObjects, which I use in the .xaml file to dataBind to: <StackPanel> <ItemsControl ItemsSource="{Binding TopObjectList}" DataTemplateSelector="{DynamicResource templateSelector"/> </StackPanel> I can make a datatemplate for every type of FrameworkElement I want to generate, but I'm having trouble with the TabControl. I can create a datatemplate for the

Get and Iterate through Controls from a TabItem?

喜你入骨 提交于 2019-11-28 05:38:21
问题 How to get all the Controls/UIElements which are nested in a Tabitem (from a TabControl)? I tried everything but wasn't able to get them. (Set the SelectedTab): private TabItem SelectedTab = null; private void tabControl1_SelectionChanged(object sender, SelectionChangedEventArgs e) { SelectedTab = (TabItem)tabControl1.SelectedItem; } Now I need something like this: private StackPanel theStackPanelInWhichLabelsShouldBeLoaded = null; foreach (Control control in tabControl.Children /*doesnt