From 21e28b068c8d0763a6d4ab613388a77a0db157fb Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期一, 03 三月 2025 19:01:30 +0800
Subject: [PATCH] 优化结构;
---
WPFProject/Controls/MainTabControl.xaml | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/WPFProject/Controls/MainTabControl.xaml b/WPFProject/Controls/MainTabControl.xaml
index e2655f1..2949177 100644
--- a/WPFProject/Controls/MainTabControl.xaml
+++ b/WPFProject/Controls/MainTabControl.xaml
@@ -13,29 +13,33 @@
</ResourceDictionary.MergedDictionaries>
<Style TargetType="ListBox" x:Key="ListBoxItemStyle1">
- <Setter Property="Background" Value="{StaticResource MainMenu}"/>
+ <Setter Property="Background" Value="{StaticResource PrimaryColor}"/>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="ListBoxItem">
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="0"/>
+ <Setter Property="Foreground" Value="{StaticResource PrimaryColorContract}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
- <Border x:Name="border" Background="{StaticResource MainMenu}"
- Padding="10" Margin="0" BorderThickness="0,0,1,0" BorderBrush="Gray">
+ <Border x:Name="border" Background="{StaticResource PrimaryColor}"
+ Padding="10" Margin="0" BorderThickness="0,0,1,1"
+ BorderBrush="Gray">
<!-- 鍐呭鍛堢幇鍣� -->
<StackPanel>
- <ContentPresenter Content="{TemplateBinding Content}"
+ <ContentPresenter x:Name="cp" Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</StackPanel>
-
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
- <Setter TargetName="border" Property="Background" Value="{StaticResource ButtonSelected}" />
+ <Setter TargetName="border" Property="Background"
+ Value="{StaticResource WorkspaceBackground}"/>
+ <Setter Property="Foreground" Value="{StaticResource PrimaryColor}"/>
+ <Setter TargetName="border" Property="BorderThickness" Value="0,0,0,0"/>
</Trigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=Self}, Path=(ItemsControl.AlternationIndex)}" Value="0">
@@ -43,7 +47,8 @@
</DataTrigger>
<Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="border" Property="Background" Value="Red" />
+ <Setter TargetName="border" Property="Background" Value="{StaticResource SecondPrimaryColor}" />
+ <Setter Property="Foreground" Value="{StaticResource SecondPrimaryColorContract}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
@@ -64,8 +69,8 @@
<DataTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" >
<Image Width="20" Height="20" Margin="5" Source="{Binding Icon}"/>
- <Label x:Name="txt" Visibility="Visible" BorderThickness="0"
- Foreground="{StaticResource PrimaryColorContract}"
+ <Label x:Name="txt" BorderThickness="0"
+ Foreground="{Binding Foreground,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBoxItem}}"
FontWeight="Bold"
FontSize="16"
VerticalContentAlignment="Center"
@@ -103,7 +108,7 @@
Visibility="{Binding MenuVisibility}"
SelectedItem="{Binding SelectedSubMenu}" AlternationCount="{Binding SubMenuItemsCount}"
SelectionChanged="SubMenu_SelectionChanged"
-BorderThickness="0,0,0,1" ItemsSource="{Binding SubMenuItems}">
+BorderThickness="0" ItemsSource="{Binding SubMenuItems}">
</ListBox>
<Border x:Name="page" Grid.Row="2" BorderThickness="0" Margin="0" Padding="0">
--
Gitblit v1.9.1