tabcontrol

Make TabControl Headers Scrollable in WPF

三世轮回 提交于 2019-12-18 17:23:13
问题 As Mentioned in Title, I want to change the header of my TabControl to be scrollable. The reason: I have too many tabItems, and the wrapping is not the best solution in my case. so I want to change it from : To something like that (Scroll bar indicated by the arrow) : Can anyone help me and show how to do that ? (I'm using wpf) 回答1: Changing TabControl.Template to something simple like this seems to work for me <TabControl ...> <TabControl.Template> <ControlTemplate TargetType="{x:Type

Binding TabControl ItemsSource to Collection of ViewModels

旧城冷巷雨未停 提交于 2019-12-18 16:19:12
问题 For some reason I am having a heck of a time getting my TabControl to display properly when binding the ItemsSource to a ObservableCollection of view models. I'm basing my design off of the tutorial found here: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx. I did find a few questions like mine here but none addressed my particular situation. This is my TabControl in xaml. <TabControl ItemsSource="{Binding Workspaces}" SelectedIndex="{Binding ActiveWorkspaceIndex}" ItemTemplate="

On the WPF TabControl - can I add content next to the tab headers?

对着背影说爱祢 提交于 2019-12-18 11:53:44
问题 Is there an easy way to position another control (i.e. a button) inline and to the right of tab headers in WPF? In the web, I would use a float or absolute positioning to accomplish this. The red line in this picture is what I am trying to get to: (source: jonkragh.com) Thanks! Jon 回答1: The robust way to do this is to re-template the TabControl as I did for the close button in my ActiveAwareCommand sample: <ControlTemplate x:Key="TabControlTemplate" TargetType="TabControl"> <Grid ClipToBounds

WPF Caliburn.Micro and TabControl with UserControls issue

若如初见. 提交于 2019-12-18 10:29:23
问题 I'm pretty sure this has been answered somewhere, but I can't seem to find it for the life of me. I'm trying to use a TabControl to switch between UserControls (each tab is different, so not using Items) Here's the breakdown: I have my mainview, and 3 usercontrols. Mainview has a tab control - each tab should display a different user control. I could easily just set the tabcontrol contect to the usercontrol using But then it isn't bound to the viewmodel, only the view. So I'm using Conductor

RelativeSource in DataTemplate works with TabControl but not with TabItem

对着背影说爱祢 提交于 2019-12-18 08:55:57
问题 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=

multiple userControl instances in tabControl

 ̄綄美尐妖づ 提交于 2019-12-18 05:15:16
问题 I have a tabControl that is bound to an observable collection. In the headerTemplate, I would like to bind to a string property, and in the contentTemplate I have placed a user-control. Here's the code for the MainWindow.xaml: <Grid> <Grid.Resources> <DataTemplate x:Key="contentTemplate"> <local:UserControl1 /> </DataTemplate> <DataTemplate x:Key="itemTemplate"> <Label Content="{Binding Path=Name}" /> </DataTemplate> </Grid.Resources> <TabControl IsSynchronizedWithCurrentItem="True"

WPF - Overlapping Custom Tabs in a TabControl and ZIndex

£可爱£侵袭症+ 提交于 2019-12-18 04:44:11
问题 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

Copy TabControl Tab

情到浓时终转凉″ 提交于 2019-12-17 19:49:58
问题 I searched the internet for this but i couldn't find how to do it with C# What i am trying to do is make it so that when i click on my NewTab button, a new tab appears with the same controls that were on the first tab. I saw some information on how to add a UserControl to your form, but C# doesn't have anything like that. And for everyone who would say "Post your code", i don't have any, so don't bother saying that, the only code i have is the code for the program and that wouldn't help

Let WPF Tabcontrol height assume height of largest item?

对着背影说爱祢 提交于 2019-12-17 18:36:13
问题 Is there any way to have to tabcontrol take the size of the largest tab item (well, actually, the tabitem's content)? Since the tabcontrol has no specific size assigned it should autosize: it does that correctly, but when you switch tabs it automatically resizes itself to the height (and width) of the contents of the currently selected tab. I don't want the resizing to happen, and let the tabcontrol assume the height of the largest item, but still have it autosize itself. Any clues? I tried

TabControl with Add New Tab Button (+)

血红的双手。 提交于 2019-12-17 10:26:27
问题 What is the proper way of adding a '+' button tab at the end of all the tab items in the tab strip of a tab control in WPF? It should work correctly with multiple tab header rows. It should be at the end of all tab items Tab cycling should work correctly ( Alt + Tab ), that is, the + tab should be skipped. I shouldn't have to modify the source collection I am binding to. That is, the control should be reusable. The solution should work with MVVM To be more precise, the button should appear