tabitem

Trigger for IsMouseOver on TabItem ContenTemplate

孤人 提交于 2019-12-08 02:08:09
问题 I have a problem with a TabItem Style and maybe someone of you can help me. Following the Style at issue: <Style x:Key="ChildrenTabItemStyle" TargetType="TabItem"> <Style.Resources> <SolidColorBrush x:Key="ButtonNormalBackground" Color="#FFEAE8E8"/> <LinearGradientBrush x:Key="ButtonOverBackground" EndPoint="0,1" StartPoint="0,0"> <GradientStop Color="#FFFAFAFA" Offset="0"/> <GradientStop Color="#FFE0E0E3" Offset="1"/> </LinearGradientBrush> <LinearGradientBrush x:Key="ButtonPressedBackground

How to change the order of the TabItem in the wpf TabControl

泄露秘密 提交于 2019-12-07 08:57:02
问题 I need to change the order of the TabItem. I've tried with Remove / Insert and it doesn't works. void UserControl_Loaded(object sender, RoutedEventArgs e) { if(condition) { TabControl.Items.Remove(TabItem); TabControl.Items.Insert(0, TabItem); } } InvalidOperationException: Element already has a logical parent. It must be detached from the old parent before it is attached to a new one. How to solve this? 回答1: Solved using the "for" instead of "foreach". if(condition) { var tabItem = Tab.Items

IsSelected property of WPF TabItem

谁都会走 提交于 2019-12-07 00:28:51
问题 I have the following code: <TabItem Name="tabItemGeneral"> <TabItem.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter TargetName="tabGeneralImg" Property="Source" Value="Image/tabGeneralActive.png"></Setter> </Trigger> </TabItem.Triggers> <TabItem.Header> <StackPanel Orientation="Horizontal" Margin="0,-3,0,0"> <Image Name="tabGeneralImg" Source="Images/tabGeneral.png" Width="11" Height="11"></Image> <Label Name="tabGeneralLbl" Content="General"></Label> </StackPanel> </TabItem

WPF: How to set background of TabItem?

随声附和 提交于 2019-12-06 18:20:00
问题 How to set the background of TabItem? I tried the following code: <TabControl> <TabItem Header="Test" Background="Blue" Foreground="Red" /> </TabControl> Foreground works, but Background does not work. Any ideas? Thanks 回答1: What is happening is that in the case of a single tab, it is always selected, and so you are only seeing the selection style of the tab item. For example, take a look at the following TabControl: <TabControl> <TabItem Header="Tab A" Background="Blue" Foreground="Red">

Trigger for IsMouseOver on TabItem ContenTemplate

本小妞迷上赌 提交于 2019-12-06 06:16:52
I have a problem with a TabItem Style and maybe someone of you can help me. Following the Style at issue: <Style x:Key="ChildrenTabItemStyle" TargetType="TabItem"> <Style.Resources> <SolidColorBrush x:Key="ButtonNormalBackground" Color="#FFEAE8E8"/> <LinearGradientBrush x:Key="ButtonOverBackground" EndPoint="0,1" StartPoint="0,0"> <GradientStop Color="#FFFAFAFA" Offset="0"/> <GradientStop Color="#FFE0E0E3" Offset="1"/> </LinearGradientBrush> <LinearGradientBrush x:Key="ButtonPressedBackground" EndPoint="0,1" StartPoint="0,0"> <GradientStop Color="#FFE0E0E2" Offset="0"/> <GradientStop Color="

Silverlight TabItem Visibility not changing

假装没事ソ 提交于 2019-12-06 05:32:33
I have a TabControl with many TabItems binding to a ViewModel that has properties for each TabItem's Visibility. <sdk:TabControl> <sdk:TabItem Name="Inventory" Header="Inventory" Style="{StaticResource TabItemStyle}" Visibility="{Binding Permissions.Inventory, Converter={StaticResource PermissiveVisibilityConverter}, ConverterParameter='Viewer'}" DataContext="{Binding VM}" /> </sdk:TabControl> All TabItems are defaulted to a Visibility of collapsed. But when the VM changes a TabItem to Visible it does not work until you move your mouse over the control... Even if I set the visibility

IsSelected property of WPF TabItem

烈酒焚心 提交于 2019-12-05 05:51:48
I have the following code: <TabItem Name="tabItemGeneral"> <TabItem.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter TargetName="tabGeneralImg" Property="Source" Value="Image/tabGeneralActive.png"></Setter> </Trigger> </TabItem.Triggers> <TabItem.Header> <StackPanel Orientation="Horizontal" Margin="0,-3,0,0"> <Image Name="tabGeneralImg" Source="Images/tabGeneral.png" Width="11" Height="11"></Image> <Label Name="tabGeneralLbl" Content="General"></Label> </StackPanel> </TabItem.Header> <Grid> <!-- ... --> </Grid> </TabItem> but I get Error 1 'IsSelected' member is not valid because

TabControl: all TabItems collapsed, but content of 1st TabItem still visible

牧云@^-^@ 提交于 2019-12-05 01:53:55
问题 I've got a rather strange behavior on a TabControl, whose TabItems are all collapsed: The content of the first TabItem is still visible (but the header is not). The TabControl and its TabItems are setup like this: <TabControl> <TabItem Header="Data 1" Visibility="{Binding Path=DataTable1.HasRows, Converter={StaticResource BoolToVisibility}}"> <UI:ShowData DataContext="{Binding Path=DataTable1}"/> </TabItem> <TabItem Header="Data 2" Visibility="{Binding Path=DataTable2.HasRows, Converter=

WPF: How to set background of TabItem?

怎甘沉沦 提交于 2019-12-05 01:17:35
How to set the background of TabItem? I tried the following code: <TabControl> <TabItem Header="Test" Background="Blue" Foreground="Red" /> </TabControl> Foreground works, but Background does not work. Any ideas? Thanks Oppositional What is happening is that in the case of a single tab, it is always selected, and so you are only seeing the selection style of the tab item. For example, take a look at the following TabControl: <TabControl> <TabItem Header="Tab A" Background="Blue" Foreground="Red"> <Grid /> </TabItem> <TabItem Header="Tab B" Background="Green" Foreground="Navy" > <Grid /> <

TabControl: all TabItems collapsed, but content of 1st TabItem still visible

余生颓废 提交于 2019-12-03 16:15:50
I've got a rather strange behavior on a TabControl, whose TabItems are all collapsed: The content of the first TabItem is still visible (but the header is not). The TabControl and its TabItems are setup like this: <TabControl> <TabItem Header="Data 1" Visibility="{Binding Path=DataTable1.HasRows, Converter={StaticResource BoolToVisibility}}"> <UI:ShowData DataContext="{Binding Path=DataTable1}"/> </TabItem> <TabItem Header="Data 2" Visibility="{Binding Path=DataTable2.HasRows, Converter={StaticResource BoolToVisibility}}"> <UI:ShowData DataContext="{Binding Path=DataTable2}"/> </TabItem> <