tabcontrol

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

Reorder tabs in WPF TabControl

柔情痞子 提交于 2019-11-29 08:11:29
问题 Is there an easy way to customize the WPF TabControl so that it supports TabItem drag and drop - similar to what IE and firefox do. 回答1: You could use or get started with Bea Stollnitz's existing helpers for Dragging and Dropping in an ItemsControl. It does have some limitations as she mentions, but it's a great place to start, and probably will work as is for most all of the functionality you will require. After importing her DragDropHelper and Adorner classes, it's very simple to use them

multiple userControl instances in tabControl

风流意气都作罢 提交于 2019-11-29 08:06:35
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" ItemsSource="{Binding Path=Pages}" ItemTemplate="{StaticResource itemTemplate}" ContentTemplate="{StaticResource

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

How to Achieve Lazy Binding of Tab Page Controls in WPF?

懵懂的女人 提交于 2019-11-29 04:04:24
问题 I have an entity class. This entity has lots of properties and entity's data is shown to the user in several TabItems of a TabControl . I also implement MVVM approach. When the screen is shown to the user first, I want to bind only the active tab page controls and as the user navigates through tab pages additional separate bindings will be incurred as-needed. How can I achieve that? 回答1: You don't have anything to do, that's the default behavior. The DataTemplate for a TabItem content won't

Adding TabItems dynamically

人走茶凉 提交于 2019-11-29 03:07:17
问题 I have a TabControl control <TabControl Name="Farms_myVillages" ItemsSource="{Binding Villages}"> </TabControl/> In the code behind I add some tabs dynamically to the TabControl as follows: foreach (Village vill in Villages) { TabItem tab = new TabItem(); tab.Header = vill.Name; VillageUserControl c = new VillageUserControl(); c.DataContext = vill; tab.Content = c; Farms_myVillages.Items.Add(tab); } where VillageUserControl is a UserControl that deal with the specified village. This code

How do I create a TabControl with no tab headers?

蓝咒 提交于 2019-11-29 02:36:57
How do I make a tab manager that doesn't show the tab headers? This is a winforms application, and the purpose of using a tab manager is so the display content can only be changed through code. It's good for menus where various menu options change the screen contents. Hiding the tabs on a standard TabControl is pretty simple, once you know the trick. The tab control is sent a TCM_ADJUSTRECT message when it needs to adjust the tab size, so we just need to trap that message. (I'm sure this has been answered before, but posting the code is easier than searching for it.) Add the following code to

Different views/usercontrols on each tab of a TabControl

 ̄綄美尐妖づ 提交于 2019-11-29 02:34:27
I'm trying to write a program that uses tabs to hold different usercontrols. What I currently want to happen is the user clicks a find button, a new tab is created, and a find screen appears inside it. Using the find screen the user can select clients and these then open in their own new tabs allowing the user to edit them. So if the user went in and selected three clients, the screen would have four tabs, one for the find screen and three client tabs. It will also need to close the tab when the user clicks an exit button on the usercontrol in that tab. My problem is that I'm not sure how to

Add extra items when using ItemsSource

冷暖自知 提交于 2019-11-29 02:02:22
In the project I am building I have a TabControl in which I want to display a range of tabs through an ItemsSource . I also need to have a few "overview" tabs at the beginning of the TabControl , that cannot be located in ItemsSource . What is the best way to achieve this, the only way I can think of is to have my overview tabs in my XAML and to just add tab items manually through code instead of using ItemSource is this the best way to go about it. You can use CompositeCollection ( MSDN ) to accomplish this: <Window.Resources> <CollectionViewSource x:Key="ExistingTabs" Source="{Binding

Binding TabControl ItemsSource to an ObservableCollection of ViewModels causes content to refresh on focus

假装没事ソ 提交于 2019-11-28 22:09:09
I'm creating an WPF application using the MVVM framework, and I've adopted several features from Josh Smith's article on MVVM here... Most importantly, I'm binding a TabControl to an ObservableCollection of ViewModels. This means that am using a tabbed MDI interface that displays a UserControl as the content of a TabItem. The issue I'm seeing in my application is that when I have several tabs and I flip back and forth between tabs, the content is being refersh each time I change tabs. If you download Josh Smith's source code, you'll see that his app has the same problem. For example, click on