tabitem

Collection was modified; enumeration operation may not execute

一个人想着一个人 提交于 2020-01-24 21:16:07
问题 I have multiple TabItems in my TabControl; tabItem1, tabItem2, tabItem3...these are CloseableTabItem. If I add a node in tabItem1 and press a button to make a subGraph model for this node, the same node should appear in tabItem2 with a button; so that tabItem2-Header = nodeName and nodeName = tabItem1-Header. if i press the button from the node in tabitem2, tabitem1 should be focused. if i close tabItem1 and press the same Button tabItem1 should be loaded again(this happen in SubGraphButton

ListBox in TabControl scrolling issue

天涯浪子 提交于 2020-01-19 14:55:50
问题 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

ListBox in TabControl scrolling issue

本秂侑毒 提交于 2020-01-19 14:55:25
问题 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

Custom TabItem in TabControl

笑着哭i 提交于 2020-01-17 01:09:10
问题 I've created CustomTabItem which inherits from TabItem and i'd like to use it while binding ObservableCollection in TabControl <TabControl ItemsSource="{Binding MyObservableCollection}"/> It should like this in XAML, but i do not know how change default type of the output item created by TabControl while binding. I've tried to create converter, but it has to do something like this inside convertin method: List<CustomTabItem> resultList = new List<CustomTabItem>(); And iterate through my input

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

十年热恋 提交于 2020-01-14 11:46:40
问题 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> </TabItem> </TabControl> 回答1: I figured this out with the help of Matt Hamilton. This actually works fine if you are using a regular TabControl (default Template). I am using a

How to delete a Tab Item based off of it's name or header

心不动则不痛 提交于 2020-01-05 04:14:21
问题 This question is similar to this question I asked earlier today. The difference is, now I would like to delete a Tab Item referenced by it's name or header . Can I call Remove in a fashion similar to the answer I got on this question? This is what I've tried: tabControl.Items.Remove = tabControl.Items //Changes tab according to TreeView .OfType<TabItem>().SingleOrDefault(n => n.Name == stringValue); Can I use something like this? If so, how? 回答1: I don't know much about removing from wpf,

How to make only the header of the tabitem respond to the mouse event

。_饼干妹妹 提交于 2019-12-25 16:51:00
问题 I'm trying to make only the header of the TabItem send an event. So far I have my xaml... <TabControl> <TabItem Header="tab 1"> Any text </TabItem> <TabItem Header="tab 2"> <TextBox>blah</TextBox> </TabItem> <TabControl.Resources> <Style TargetType="TabItem"> <EventSetter Event="MouseDoubleClick" Handler="TabItemMouseDoubleClick"/> </Style> </TabControl.Resources> </TabControl> ...and my event handler... void TabItemMouseDoubleClick(object sender, MouseButtonEventArgs e) {} Now, when double

Change Image on IsSelected TabControl

天涯浪子 提交于 2019-12-25 02:39:10
问题 I want to be able to change the image of the tabItem when it is selected but I'm really struggling at the moment to understand how others implement use of styles, templates and triggers. I have this so far: <TabControl HorizontalAlignment="Left" Height="386" VerticalAlignment="Top" Width="600" TabStripPlacement="Left" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="{x:Null}"> <TabItem Header="TabItem" BorderBrush="{x:Null}" Foreground="{x:Null}" Margin="-2,-2,-1,-28" Width="40"