询问者
选中TabItem时,TabItem的背景边框与TabControl贴合着的那部分的颜色怎样一样

问题
全部回复
-
直接在tabcontrol上修改xaml代码即可
<TabControl BorderThickness="0" Padding="0" > <TabItem Header="Item1" > <Grid Background="Red"/> </TabItem> <TabItem Header="Item2" > <Grid Background="Black"/> </TabItem> </TabControl>
tabcontrol的边框是有定距离的。
Padding为0,是将control与tabcontrol的边框距离设置为0
BorderThickness设置为0,是将control的边框设置为0,不过太高了,可以适当修改值
- 已编辑 ARM830 2019年9月19日 1:35
-
你是想改变哪一部分颜色,能否给一张截图声明,选中属性为true触发:
<Window.Resources> <Style TargetType="{x:Type TabItem}"> <Style.Triggers> <Trigger Property="TabItem.IsSelected" Value="True"> <Setter Property="TabItem.FontWeight" Value="Bold"/> <Setter Property="TabItem.Foreground" Value="Green"/> </Trigger> </Style.Triggers> </Style> </Window.Resources>
Best Regards,
Alex
MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
-
你是想改变哪一部分颜色,能否给一张截图声明,选中属性为true触发:
<Window.Resources> <Style TargetType="{x:Type TabItem}"> <Style.Triggers> <Trigger Property="TabItem.IsSelected" Value="True"> <Setter Property="TabItem.FontWeight" Value="Bold"/> <Setter Property="TabItem.Foreground" Value="Green"/> </Trigger> </Style.Triggers> </Style> </Window.Resources>
Best Regards,
Alex
MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
,比如这种效果,下面那个显示的“团队资源管理器”TabItem,它是选中的,它有边框,而且选中项的边框色和tabControl的是一样的,但是它贴合TabControl部分的边框颜色和tabControl的背景色是一样的,这个是怎么实现的?
-
Hi,
你是想设置这个Borderbrush的颜色与tabitem的背景色一样,那么你是如何设置tabitem的背景色的?
<Grid> <TabControl Margin="20" BorderThickness="5" BorderBrush="Red"> <TabItem Header="tab1"/> <TabItem Header="tab2"/> <TabItem Header="tab3"/> </TabControl> </Grid>
Best Regards,
Alex
MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.