From 9d1660270272180cd71147d6ddd53d1382643d2e Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 02 十一月 2026 18:00:14 +0800
Subject: [PATCH] merge: 并入远程 Initial commit 作为历史根节点
---
WPFProject/Controls/MenuTabControl.xaml | 244 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 244 insertions(+), 0 deletions(-)
diff --git a/WPFProject/Controls/MenuTabControl.xaml b/WPFProject/Controls/MenuTabControl.xaml
new file mode 100644
index 0000000..3b42b64
--- /dev/null
+++ b/WPFProject/Controls/MenuTabControl.xaml
@@ -0,0 +1,244 @@
+锘�<UserControl x:Class="WPFProject.Controls.MenuTabControl"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ctl="clr-namespace:WPFProject.Controls"
+ mc:Ignorable="d"
+ Loaded="UserControl_Loaded"
+ d:DataContext="{x:Type ctl:MenuTabControl}"
+ d:DesignHeight="450" d:DesignWidth="800">
+ <UserControl.Resources>
+ <ResourceDictionary>
+ <ResourceDictionary.MergedDictionaries>
+ <ResourceDictionary Source="/HMI.UI;component/Style/Colors.xaml"/>
+ </ResourceDictionary.MergedDictionaries>
+
+ <Style x:Key="tabItemStyle" TargetType="{x:Type ctl:IconTabItem}">
+ <Setter Property="Margin" Value="0"/>
+ <Setter Property="Background" Value="{StaticResource ButtonColor}"/>
+ <Setter Property="Foreground" Value="{StaticResource ButtonFont}"/>
+ <Setter Property="HeaderFontSize" Value="15"/>
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate x:Name="ct" TargetType="{x:Type ctl:IconTabItem}">
+ <Border x:Name="templateRoot" BorderThickness="1,1,1,1" Padding="10"
+ BorderBrush="Gray"
+ Background="{TemplateBinding Background}">
+ <StackPanel HorizontalAlignment="Center">
+ <Image Width="30" Height="30" Source="{TemplateBinding Icon}"/>
+ <Label x:Name="txt" Visibility="Visible" BorderThickness="0"
+ VerticalContentAlignment="Center"
+ HorizontalAlignment="Left"
+ FontSize="{TemplateBinding HeaderFontSize}"
+ Content="{TemplateBinding Header}" ToolTip="{TemplateBinding Header}"
+ Foreground="{TemplateBinding Foreground}" />
+ </StackPanel>
+ </Border>
+ <ControlTemplate.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
+ </MultiDataTrigger.Conditions>
+ <Setter Property="BorderThickness" TargetName="templateRoot" Value="1,1,1,1"/>
+ <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ButtonFontSelected}"/>
+ </MultiDataTrigger>
+
+
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="true"/>
+ </MultiDataTrigger.Conditions>
+ <Setter Property="Foreground" TargetName="txt" Value="{StaticResource ButtonFontSelected}"/>
+ <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ButtonSelected}"/>
+ </MultiDataTrigger>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
+ <Style x:Key="SubControlStyle" TargetType="{x:Type TabControl}">
+ <Setter Property="BorderThickness" Value="0"/>
+ <Setter Property="BorderBrush" Value="Transparent"/>
+ <Setter Property="ItemContainerStyle" Value="{StaticResource tabItemStyle}"/>
+ <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type TabControl}">
+ <Grid x:Name="templateRoot" ClipToBounds="True" SnapsToDevicePixels="True" KeyboardNavigation.TabNavigation="Local">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition x:Name="ColumnDefinition0" />
+ <ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition x:Name="RowDefinition0" Height="Auto"/>
+ <RowDefinition x:Name="RowDefinition1" Height="*"/>
+ </Grid.RowDefinitions>
+ <!--<UniformGrid x:Name="HeaderPanel" Rows="1" Background="Transparent" Grid.Column="0" IsItemsHost="True" Margin="0" Grid.Row="0" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1"/>-->
+ <ScrollViewer Visibility="{Binding ShowMenu}" Grid.Row="0" Grid.Column="0" VerticalScrollBarVisibility="Auto"
+ HorizontalScrollBarVisibility="Auto" >
+ <StackPanel Orientation="Horizontal" x:Name="HeaderPanel"
+ ScrollViewer.HorizontalScrollBarVisibility="Auto"
+ IsItemsHost="True"
+ Margin="0" KeyboardNavigation.TabIndex="1"
+ Background="{StaticResource MainMenu}"
+ Panel.ZIndex="1"/>
+ </ScrollViewer>
+
+ <!--<Line X1="0" X2="{Binding ActualWidth, RelativeSource={RelativeSource Self}}"
+ Stroke="Transparent" StrokeThickness="0.1"
+ VerticalAlignment="Bottom" Margin="0" SnapsToDevicePixels="True"/>-->
+ <Border x:Name="ContentPanel" BorderBrush="{TemplateBinding BorderBrush}"
+ BorderThickness="{TemplateBinding BorderThickness}"
+ Background="{TemplateBinding Background}"
+ Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained"
+ Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
+
+ <ContentPresenter x:Name="PART_SelectedContentHost"
+ ContentTemplate="{TemplateBinding SelectedContentTemplate}"
+ Content="{TemplateBinding SelectedContent}"
+ ContentStringFormat="{TemplateBinding SelectedContentStringFormat}"
+ ContentSource="SelectedContent" Margin="0"
+ SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
+
+ </Border>
+ </Grid>
+ <ControlTemplate.Triggers>
+ <Trigger Property="TabStripPlacement" Value="Bottom">
+ <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="1"/>
+ <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
+ <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
+ <Setter Property="Height" TargetName="RowDefinition1" Value="Auto"/>
+ </Trigger>
+ <Trigger Property="TabStripPlacement" Value="Left">
+ <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="0"/>
+ <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
+ <Setter Property="Grid.Column" TargetName="HeaderPanel" Value="0"/>
+ <Setter Property="Grid.Column" TargetName="ContentPanel" Value="1"/>
+ <Setter Property="Width" TargetName="ColumnDefinition0" Value="Auto"/>
+ <Setter Property="Width" TargetName="ColumnDefinition1" Value="*"/>
+ <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
+ <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
+ </Trigger>
+ <Trigger Property="TabStripPlacement" Value="Right">
+ <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="0"/>
+ <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
+ <Setter Property="Grid.Column" TargetName="HeaderPanel" Value="1"/>
+ <Setter Property="Grid.Column" TargetName="ContentPanel" Value="0"/>
+ <Setter Property="Width" TargetName="ColumnDefinition0" Value="*"/>
+ <Setter Property="Width" TargetName="ColumnDefinition1" Value="Auto"/>
+ <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
+ <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
+ </Trigger>
+ <Trigger Property="IsEnabled" Value="False">
+ <Setter Property="TextElement.Foreground" TargetName="templateRoot" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
+ </Trigger>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
+ <Style x:Key="ControlStyle" TargetType="{x:Type TabControl}">
+ <Setter Property="BorderThickness" Value="0"/>
+ <Setter Property="BorderBrush" Value="Transparent"/>
+ <Setter Property="ItemContainerStyle" Value="{StaticResource tabItemStyle}"/>
+ <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type TabControl}">
+ <Grid x:Name="templateRoot" ClipToBounds="True" SnapsToDevicePixels="True" KeyboardNavigation.TabNavigation="Local">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition x:Name="ColumnDefinition0" />
+ <ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition x:Name="RowDefinition0" Height="Auto"/>
+ <RowDefinition x:Name="RowDefinition1" Height="*"/>
+ </Grid.RowDefinitions>
+ <!--<UniformGrid x:Name="HeaderPanel" Rows="1" Background="Transparent" Grid.Column="0" IsItemsHost="True" Margin="0" Grid.Row="0" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1"/>-->
+ <ScrollViewer Visibility="{Binding ShowMenu}" Grid.Row="0" Grid.Column="0" VerticalScrollBarVisibility="Auto"
+ HorizontalScrollBarVisibility="Auto" >
+ <StackPanel Orientation="Horizontal" x:Name="HeaderPanel"
+ ScrollViewer.HorizontalScrollBarVisibility="Auto"
+ IsItemsHost="True"
+ Margin="0" KeyboardNavigation.TabIndex="1"
+ Background="{StaticResource MainMenu}"
+ Panel.ZIndex="1"/>
+ </ScrollViewer>
+
+ <!--<Line X1="0" X2="{Binding ActualWidth, RelativeSource={RelativeSource Self}}"
+ Stroke="Transparent" StrokeThickness="0.1"
+ VerticalAlignment="Bottom" Margin="0" SnapsToDevicePixels="True"/>-->
+ <Border x:Name="ContentPanel" BorderBrush="{TemplateBinding BorderBrush}"
+ BorderThickness="{TemplateBinding BorderThickness}"
+ Background="{TemplateBinding Background}"
+ Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained"
+ Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
+
+ <TabControl x:Name="contentTab"
+ Style="{StaticResource SubControlStyle}"
+ ItemsSource="{Binding TabSelectedItem.Children,Mode=TwoWay}">
+
+
+ </TabControl>
+
+ <!--<ContentPresenter x:Name="PART_SelectedContentHost"
+ ContentTemplate="{TemplateBinding SelectedContentTemplate}"
+ Content="{TemplateBinding SelectedContent}"
+ ContentStringFormat="{TemplateBinding SelectedContentStringFormat}"
+ ContentSource="SelectedContent" Margin="0"
+ SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>-->
+
+ </Border>
+ </Grid>
+ <ControlTemplate.Triggers>
+ <Trigger Property="TabStripPlacement" Value="Bottom">
+ <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="1"/>
+ <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
+ <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
+ <Setter Property="Height" TargetName="RowDefinition1" Value="Auto"/>
+ </Trigger>
+ <Trigger Property="TabStripPlacement" Value="Left">
+ <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="0"/>
+ <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
+ <Setter Property="Grid.Column" TargetName="HeaderPanel" Value="0"/>
+ <Setter Property="Grid.Column" TargetName="ContentPanel" Value="1"/>
+ <Setter Property="Width" TargetName="ColumnDefinition0" Value="Auto"/>
+ <Setter Property="Width" TargetName="ColumnDefinition1" Value="*"/>
+ <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
+ <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
+ </Trigger>
+ <Trigger Property="TabStripPlacement" Value="Right">
+ <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="0"/>
+ <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
+ <Setter Property="Grid.Column" TargetName="HeaderPanel" Value="1"/>
+ <Setter Property="Grid.Column" TargetName="ContentPanel" Value="0"/>
+ <Setter Property="Width" TargetName="ColumnDefinition0" Value="*"/>
+ <Setter Property="Width" TargetName="ColumnDefinition1" Value="Auto"/>
+ <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
+ <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
+ </Trigger>
+ <Trigger Property="IsEnabled" Value="False">
+ <Setter Property="TextElement.Foreground" TargetName="templateRoot" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
+ </Trigger>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+ </ResourceDictionary>
+ </UserControl.Resources>
+
+ <Grid>
+ <TabControl x:Name="tabLevel_1"
+ Grid.Row="0"
+ Style="{StaticResource ControlStyle}" ItemsSource="{Binding Items}"
+ SelectedItem="{Binding TabSelectedItem,Mode=TwoWay}"
+ SelectionChanged="tabLevel_1_SelectionChanged">
+
+ </TabControl>
+
+ </Grid>
+</UserControl>
--
Gitblit v1.9.1