<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:cv="clr-namespace:MainShell.Converter"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:commonDisp="clr-namespace:MainShell.Common.Display.View" xmlns:commonViewModel="clr-namespace:MainShell.Common.Display.ViewModel" xmlns:controlAttr="clr-namespace:MainShell.Common.ControlAttribute">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Resources/Styles/ButtonStyles.xaml"/>
        <ResourceDictionary Source="/Resources/Styles/NumberLimit.xaml"/>
        <ResourceDictionary Source="/Resources/Styles/ProcessParameterStyles.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    <FontFamily x:Key="ttfFont">/MainShell;component/Resources/Font/#iconfont</FontFamily>

    <!-- 全局转换器 -->
    <cv:DateTimeToStringConverter x:Key="DateTimeToStringConverter"/>
    <cv:BoolToVisibleConverter x:Key="BoolToVisibleConverter"/>
    <cv:BoolToInversionConverter x:Key="boolToInversionConverter"/>
    <cv:EnumDescriptionConverter x:Key="EnumDescriptionConverter"/>
    <cv:ScreenToViewModelConverter x:Key="ScreenToViewModelConverter"/>
    <cv:BondingPathModeToBoolConverter x:Key="BondingPathModeToBoolConverter"/>
    <cv:BondingRegionModeToBoolConverter x:Key="BondingRegionModeToBoolConverter"/>
    <cv:BondingWsPathModeToBoolConverter x:Key="BondingWsPathModeToBoolConverter"/>
    <cv:RunningModeEnumToBoolConverter x:Key="RunningModeToBoolConverter"/>
    <cv:SubstrateHeightMeasureModeToBoolConverter x:Key="SubstrateHeightMeasureModeToBoolConverter"/>
    <cv:ObjectToBoolConverter x:Key="ObjectToBoolConverter"/>

    <SolidColorBrush x:Key="GlobalScrollBarTrackBackgroundBrush" Color="#F6F8FB"/>
    <SolidColorBrush x:Key="GlobalScrollBarTrackBorderBrush" Color="#D7DEE8"/>
    <SolidColorBrush x:Key="GlobalScrollBarButtonHoverBrush" Color="#F1F5FA"/>
    <SolidColorBrush x:Key="GlobalScrollBarButtonPressedBrush" Color="#E5ECF5"/>
    <SolidColorBrush x:Key="GlobalScrollBarArrowBrush" Color="#9FB0C4"/>
    <SolidColorBrush x:Key="GlobalScrollBarThumbBrush" Color="#D5E1EE"/>
    <SolidColorBrush x:Key="GlobalScrollBarThumbHoverBrush" Color="#C7D6E6"/>
    <SolidColorBrush x:Key="GlobalScrollBarThumbPressedBrush" Color="#B8CBDF"/>

    <Style x:Key="GlobalScrollBarThumbStyle" TargetType="Thumb">
        <Setter Property="Background" Value="{StaticResource GlobalScrollBarThumbBrush}"/>
        <Setter Property="MinHeight" Value="24"/>
        <Setter Property="MinWidth" Value="24"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Thumb">
                    <Border x:Name="ThumbBorder"
                            Margin="3,2"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{StaticResource GlobalScrollBarTrackBorderBrush}"
                            BorderThickness="1"
                            CornerRadius="3"/>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="ThumbBorder" Property="Background" Value="{StaticResource GlobalScrollBarThumbHoverBrush}"/>
                        </Trigger>
                        <Trigger Property="IsDragging" Value="True">
                            <Setter TargetName="ThumbBorder" Property="Background" Value="{StaticResource GlobalScrollBarThumbPressedBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="GlobalScrollBarPageButtonStyle" TargetType="RepeatButton">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="RepeatButton">
                    <Border Background="Transparent"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="GlobalScrollBarLineButtonStyle" TargetType="RepeatButton">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="RepeatButton">
                    <Border x:Name="ButtonBorder"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{StaticResource GlobalScrollBarTrackBorderBrush}"
                            BorderThickness="1"
                            CornerRadius="2">
                        <Viewbox Width="6" Height="6" Stretch="Uniform">
                            <Path x:Name="ArrowPath"
                                  Fill="{StaticResource GlobalScrollBarArrowBrush}"
                                  Data="M 0 5 L 4 1 L 8 5 Z"/>
                        </Viewbox>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Tag" Value="Down">
                            <Setter TargetName="ArrowPath" Property="Data" Value="M 0 1 L 4 5 L 8 1 Z"/>
                        </Trigger>
                        <Trigger Property="Tag" Value="Left">
                            <Setter TargetName="ArrowPath" Property="Data" Value="M 5 0 L 1 4 L 5 8 Z"/>
                        </Trigger>
                        <Trigger Property="Tag" Value="Right">
                            <Setter TargetName="ArrowPath" Property="Data" Value="M 1 0 L 5 4 L 1 8 Z"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="ButtonBorder" Property="Background" Value="{StaticResource GlobalScrollBarButtonHoverBrush}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="ButtonBorder" Property="Background" Value="{StaticResource GlobalScrollBarButtonPressedBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="GlobalVerticalScrollBarTemplate" TargetType="ScrollBar">
        <Grid Background="Transparent" SnapsToDevicePixels="True">
            <Grid.RowDefinitions>
                <RowDefinition Height="14"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="14"/>
            </Grid.RowDefinitions>

            <RepeatButton Grid.Row="0"
                          Command="ScrollBar.LineUpCommand"
                          Tag="Up"
                          Style="{StaticResource GlobalScrollBarLineButtonStyle}"/>

            <Border Grid.Row="1"
                    Margin="2,0"
                    Background="{StaticResource GlobalScrollBarTrackBackgroundBrush}"
                    BorderBrush="{StaticResource GlobalScrollBarTrackBorderBrush}"
                    BorderThickness="1"
                    CornerRadius="3"/>

            <Track x:Name="PART_Track"
                   Grid.Row="1"
                   Margin="2,0"
                   Focusable="False"
                   IsDirectionReversed="True">
                <Track.DecreaseRepeatButton>
                    <RepeatButton Command="ScrollBar.PageUpCommand"
                                  Style="{StaticResource GlobalScrollBarPageButtonStyle}"/>
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb Style="{StaticResource GlobalScrollBarThumbStyle}"/>
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton Command="ScrollBar.PageDownCommand"
                                  Style="{StaticResource GlobalScrollBarPageButtonStyle}"/>
                </Track.IncreaseRepeatButton>
            </Track>

            <RepeatButton Grid.Row="2"
                          Command="ScrollBar.LineDownCommand"
                          Tag="Down"
                          Style="{StaticResource GlobalScrollBarLineButtonStyle}"/>
        </Grid>
    </ControlTemplate>

    <ControlTemplate x:Key="GlobalHorizontalScrollBarTemplate" TargetType="ScrollBar">
        <Grid Background="Transparent" SnapsToDevicePixels="True">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="14"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="14"/>
            </Grid.ColumnDefinitions>

            <RepeatButton Grid.Column="0"
                          Command="ScrollBar.LineLeftCommand"
                          Tag="Left"
                          Style="{StaticResource GlobalScrollBarLineButtonStyle}"/>

            <Border Grid.Column="1"
                    Margin="0,2"
                    Background="{StaticResource GlobalScrollBarTrackBackgroundBrush}"
                    BorderBrush="{StaticResource GlobalScrollBarTrackBorderBrush}"
                    BorderThickness="1"
                    CornerRadius="3"/>

            <Track x:Name="PART_Track"
                   Grid.Column="1"
                   Margin="0,2"
                   Focusable="False"
                   IsDirectionReversed="False">
                <Track.DecreaseRepeatButton>
                    <RepeatButton Command="ScrollBar.PageLeftCommand"
                                  Style="{StaticResource GlobalScrollBarPageButtonStyle}"/>
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb Style="{StaticResource GlobalScrollBarThumbStyle}"/>
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton Command="ScrollBar.PageRightCommand"
                                  Style="{StaticResource GlobalScrollBarPageButtonStyle}"/>
                </Track.IncreaseRepeatButton>
            </Track>

            <RepeatButton Grid.Column="2"
                          Command="ScrollBar.LineRightCommand"
                          Tag="Right"
                          Style="{StaticResource GlobalScrollBarLineButtonStyle}"/>
        </Grid>
    </ControlTemplate>

    <Style x:Key="GlobalScrollBarStyle" TargetType="ScrollBar">
        <Setter Property="Width" Value="14"/>
        <Setter Property="Height" Value="Auto"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Template" Value="{StaticResource GlobalVerticalScrollBarTemplate}"/>
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="Width" Value="Auto"/>
                <Setter Property="Height" Value="14"/>
                <Setter Property="Template" Value="{StaticResource GlobalHorizontalScrollBarTemplate}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="ScrollBar" BasedOn="{StaticResource GlobalScrollBarStyle}"/>

    <Style x:Key="ProcessScrollViewerStyle" TargetType="ScrollViewer" BasedOn="{StaticResource BaseStyle}">
        <Setter Property="Background" Value="{StaticResource ProcessCardBackgroundBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource ProcessCardBorderBrush}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Foreground" Value="{StaticResource ProcessBodyForegroundBrush}"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="controlAttr:ControlBehavior.RouteDieMapMouseWheel" Value="True"/>
        <!-- 现代化样式：保持 ScrollViewer 标准行为，融合全局滚动条配色 -->
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ScrollViewer">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="6"
                            SnapsToDevicePixels="True">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <ScrollContentPresenter x:Name="PART_ScrollContentPresenter"
                                                    Grid.Row="0" Grid.Column="0"
                                                    Margin="{TemplateBinding Padding}"
                                                    CanContentScroll="{TemplateBinding CanContentScroll}"/>

                            <ScrollBar x:Name="PART_VerticalScrollBar"
                                       Grid.Row="0" Grid.Column="1"
                                       AutomationProperties.AutomationId="VerticalScrollBar"
                                       Cursor="Arrow"
                                       Orientation="Vertical"
                                       Maximum="{TemplateBinding ScrollableHeight}"
                                       Minimum="0"
                                       Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                                       Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
                                       ViewportSize="{TemplateBinding ViewportHeight}"/>

                            <ScrollBar x:Name="PART_HorizontalScrollBar"
                                       Grid.Row="1" Grid.Column="0"
                                       AutomationProperties.AutomationId="HorizontalScrollBar"
                                       Cursor="Arrow"
                                       Orientation="Horizontal"
                                       Maximum="{TemplateBinding ScrollableWidth}"
                                       Minimum="0"
                                       Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                                       Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
                                       ViewportSize="{TemplateBinding ViewportWidth}"/>

                            <Border x:Name="ScrollBarCorner"
                                    Grid.Row="1"
                                    Grid.Column="1"
                                    Background="{StaticResource GlobalScrollBarTrackBackgroundBrush}"
                                    BorderBrush="{StaticResource GlobalScrollBarTrackBorderBrush}"
                                    BorderThickness="1,1,0,0"
                                    CornerRadius="0,0,6,0"
                                    Visibility="Collapsed"/>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="ComputedVerticalScrollBarVisibility" Value="Visible"/>
                                <Condition Property="ComputedHorizontalScrollBarVisibility" Value="Visible"/>
                            </MultiTrigger.Conditions>
                            <Setter TargetName="ScrollBarCorner" Property="Visibility" Value="Visible"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- 全局数据模板 -->
    <DataTemplate DataType="{x:Type commonViewModel:CameraAxisViewModel}">
        <commonDisp:CameraAxisView/>
    </DataTemplate>
    

    <!--画刷-->
    <SolidColorBrush x:Key="PgBackground" Color="#EEEEED"/>
    <SolidColorBrush x:Key="PgBorder" Color="#EEEEED"/>
    <SolidColorBrush x:Key="MwGroupBoxBackground" Color="#38ABF1"/>
    <!-- 基础文本样式 -->
    <Style x:Key="CommonLableStyle" TargetType="Label" BasedOn="{StaticResource {x:Type Label}}">
        <Setter Property="HorizontalContentAlignment" Value="Right"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Margin" Value="3"/>
        <Setter Property="Height" Value="35"/>
        <Setter Property="Width" Value="120"/>
    </Style>
    <Style x:Key="LabelStyle" TargetType="TextBlock">
        <Setter Property="FontWeight" Value="Bold"/>
        <Setter Property="VerticalAlignment" Value="Top"/>
        <Setter Property="Margin" Value="0,4,10,4"/>
        <Setter Property="Foreground" Value="#333333"/>
    </Style>
    <Style x:Key="TextBlockStyle" TargetType="TextBlock">
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="Margin" Value="0,4,10,4"/>
        <Setter Property="Foreground" Value="#333333"/>
        <Setter Property="HorizontalAlignment" Value="Right"/>
    </Style>
    <Style x:Key="ValueStyle" TargetType="TextBlock">
        <Setter Property="VerticalAlignment" Value="Top"/>
        <Setter Property="Margin" Value="0,4,0,4"/>
        <Setter Property="TextWrapping" Value="Wrap"/>
        <Setter Property="Foreground" Value="#111111"/>
    </Style>
    <Style x:Key="LargeTextblockStyle" TargetType="TextBlock">
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="Margin" Value="0,4,0,4"/>
        <Setter Property="FontSize" Value="18"/>
        <Setter Property="TextWrapping" Value="Wrap"/>
        <Setter Property="Foreground" Value="#111111"/>
    </Style>
    <Style x:Key="LargeBlodTextblockStyle" TargetType="TextBlock">
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="Margin" Value="0,4,0,4"/>
        <Setter Property="FontSize" Value="18"/>
        <Setter Property="FontWeight" Value="Bold"/>
        <Setter Property="TextWrapping" Value="Wrap"/>
        <Setter Property="Foreground" Value="#111111"/>
    </Style>
    <!-- GroupBox Header 样式 -->
    <Style x:Key="LeftGroupStyle" TargetType="GroupBox">
        <Setter Property="Margin" Value="0,0,0,15"/>
        <Setter Property="BorderBrush" Value="#CCCCCC"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Padding" Value="10"/>
        <Setter Property="HeaderTemplate">
            <Setter.Value>
                <DataTemplate>
                    <TextBlock Text="{Binding}" FontWeight="Bold" FontSize="14" Foreground="#005792"/>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- GroupBox 分步骤样式 -->
    <Style x:Key="GroupStepControl" TargetType="GroupBox">
        <Setter Property="BorderBrush" Value="#37DFE8"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Margin" Value="2,4"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="GroupBox">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Border SnapsToDevicePixels="True" BorderThickness="0">
                            <ContentPresenter ContentSource="Header"/>
                        </Border>
                        <Border Grid.Row="1" BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Margin="{TemplateBinding Margin}"
                            SnapsToDevicePixels="True"
                            >
                            <ContentPresenter ContentSource="Content"/>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="HeaderTemplate">
            <Setter.Value>
                <DataTemplate>
                    <TextBlock  Text="{Binding}" FontFamily="Segoe UI" FontWeight="Black"/>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--导航栏ListBox-->
    <Style TargetType="ListBox" x:Key="NavigationListBoxStyle">
        <Setter Property="Background" Value="#D7DDE4"/>
        <Setter Property="Height" Value="40"/>
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="ListBoxItem">
                    <!-- 4.1 重写ListBoxItem的控件模板，完全自定义其外观 -->
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="ListBoxItem">
                                <Border x:Name="ItemBorder"
                 Background="#EEEEF3" BorderBrush="#B0B9C4" BorderThickness="1"
                     Padding="8,8">
                                    <ContentPresenter/>
                                </Border>

                                <!-- 4.2 定义触发器，响应鼠标和选中状态 -->
                                <ControlTemplate.Triggers>
                                    <!-- 鼠标悬停时的效果 -->
                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter TargetName="ItemBorder" Property="Background" Value="Wheat"/>
                                    </Trigger>

                                    <!-- 项目被选中时的效果 -->
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter TargetName="ItemBorder" Property="Background" Value="#4B96D1"/>
                                    </Trigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ListBoxItem" x:Key="padListBoxItemStyle">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Foreground" Value="Black"/>
        <Setter Property="Padding" Value="5"/>
        <Setter Property="Margin" Value="2"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="FontSize" Value="16"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Border x:Name="Border" 
                            Background="{TemplateBinding Background}" 
                            BorderBrush="Transparent" 
                            BorderThickness="1" 
                            Padding="{TemplateBinding Padding}" 
                            SnapsToDevicePixels="True">
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <!-- 选中状态的触发器 -->
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Border" Property="Background" Value="#448EC9"/>
                            <Setter Property="Foreground" Value="White"/>
                        </Trigger>
                        <!-- 鼠标悬停状态的触发器 -->
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="Border" Property="Background" Value="#2E76CD"/>
                            <Setter Property="Foreground" Value="Black"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="ListBox" x:Key="recipeListBoxStyle">
        <Setter Property="Background" Value="#F0F3F6"/>
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="ListBoxItem" >
                    <Setter Property="Cursor" Value="Hand"/>
                    <Setter Property="Background" Value="#F0F3F6"/>
                    <Setter Property="Padding" Value="5"/>
                    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                    <Setter Property="VerticalContentAlignment" Value="Center"/>
                    <Setter Property="Opacity" Value="0.4"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="ListBoxItem">
                                <Border 
                        Background="{TemplateBinding Background}" 
                      
                        SnapsToDevicePixels="True" MinHeight="40" >
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock VerticalAlignment="Center" FontSize="18" Foreground="#3DB39E" Text="&#xe666;" FontFamily="{StaticResource ttfFont}"/>
                                        <TextBlock VerticalAlignment="Center"  FontWeight="Bold" FontSize="16"  Text="&#xe65e;" FontFamily="{StaticResource ttfFont}" Visibility="{Binding IsInUse, Converter={StaticResource BoolToVisibleConverter}}"/>
                                        <ContentPresenter 
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                        <TextBlock VerticalAlignment="Center"  FontWeight="Bold" FontSize="16"  Text="&#xe65e;" FontFamily="{StaticResource ttfFont}" Visibility="{Binding IsInUse, Converter={StaticResource BoolToVisibleConverter}}"/>
                                        <TextBlock VerticalAlignment="Center" Visibility="{Binding HasError, Converter={StaticResource BoolToVisibleConverter}}"
                                                   Margin="2,0" FontSize="16" Foreground="Red" Text="&#xe6c2;"
                                                   FontFamily="{StaticResource ttfFont}" />
                                    </StackPanel>

                                </Border>
                                <ControlTemplate.Triggers>
                                    <!-- 选中项和悬停项 -->
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter Property="Background" Value="#448EC9"/>
                                        <Setter Property="Foreground" Value="White"/>
                                        <Setter Property="Opacity" Value="1"/>
                                    </Trigger>
                                    <MultiTrigger>
                                        <MultiTrigger.Conditions>
                                            <Condition Property="IsMouseOver" Value="True"/>
                                            <Condition Property="IsSelected" Value="False"/>
                                        </MultiTrigger.Conditions>
                                        <Setter Property="Background" Value="#B5C3CD"/>
                                        <Setter Property="Foreground" Value="White"/>
                                    </MultiTrigger>
                                    <DataTrigger Binding="{Binding SelectedIndex,
                                       RelativeSource={RelativeSource AncestorType=ListBox}}" Value="-1">
                                        <Setter Property="Opacity" Value="1"/>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding IsInUse}" Value="True">
                                        <Setter Property="Foreground" Value="Blue"/>
                                    </DataTrigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                  
                </Style>

            </Setter.Value>
        </Setter>
        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <TextBlock Text="{Binding RecipeName}" FontWeight="SemiBold" VerticalAlignment="Center" FontSize="16" />
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ToggleBtnSideBarStyle" TargetType="ToggleButton">
        <Setter Property="Width" Value="30"/>
        <Setter Property="Height" Value="50"/>
        <Setter Property="Background" Value="#2196F3"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="Opacity" Value="0.15"/>
        <Setter Property="ToolTip" Value="隐藏配方列表"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToggleButton">
                    <Border Background="{TemplateBinding Background}"
                            CornerRadius="5">
                        <TextBlock    x:Name="txt"
                                  Text="&#xe7af;" 
                                  FontSize="26"
                                  FontFamily="{StaticResource ttfFont}"
                                  HorizontalAlignment="Center"
                                  VerticalAlignment="Center"
                                  Foreground="{TemplateBinding Foreground}"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="#1976D2"/>
                            <Setter Property="Opacity" Value="0.9"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter Property="Background" Value="#1565C0"/>
                            <Setter TargetName="txt" Property="Text" Value="&#xe7b0;"/>
                            <Setter Property="ToolTip" Value="显示配方列表"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="ModernCheckBoxStyle" TargetType="CheckBox">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Foreground" Value="#C2C1C2"/>
        <Setter Property="FontSize" Value="26"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="CheckBox">
                    <Border>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock x:Name="tx" Text="&#xe617;" FontFamily="{StaticResource ttfFont}"/>
                            <ContentPresenter  Content="{TemplateBinding Content}"/>
                        </StackPanel>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter TargetName="tx" Property="Text" Value="&#xe616;"/>
                            <Setter Property="Foreground" Value="#A84AF1"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="TitleBarButtonStyle" TargetType="Button">
        <Setter Property="Width" Value="32"/>
        <Setter Property="Height" Value="24"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border x:Name="root" Background="{TemplateBinding Background}">
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="root" Property="Background" Value="#11000000"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="root" Property="Background" Value="#22000000"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="TitleBarCloseButtonStyle" TargetType="Button" BasedOn="{StaticResource TitleBarButtonStyle}">
        <Setter Property="Foreground" Value="Black"/>
        <Setter Property="Content" Value="&#xe60c;"/>
        <Setter Property="FontFamily" Value="{StaticResource ttfFont}"/>
        <Setter Property="FontSize" Value="16"/>
        <Setter Property="ToolTip" Value="关闭"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border x:Name="root" Background="{TemplateBinding Background}">
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="root" Property="Background" Value="#11000000"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="root" Property="Background" Value="#22000000"/>
                            <Setter  Property="Foreground" Value="Red"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="TitleBarMinButtonStyle" TargetType="Button" BasedOn="{StaticResource TitleBarButtonStyle}">
        <Setter Property="Foreground" Value="Black"/>
        <Setter Property="Content" Value="&#xe650;"/>
        <Setter Property="FontFamily" Value="{StaticResource ttfFont}"/>
        <Setter Property="FontSize" Value="16"/>
        <Setter Property="ToolTip" Value="最小化"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border x:Name="root" Background="{TemplateBinding Background}">
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="root" Property="Background" Value="#11000000"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="root" Property="Background" Value="#22000000"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MwGroupBoxStyle" TargetType="GroupBox">
        <Setter Property="Background" Value="{StaticResource MwGroupBoxBackground}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="GroupBox">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <Border CornerRadius="4" SnapsToDevicePixels="True" Background="{TemplateBinding Background}">
                            <ContentPresenter HorizontalAlignment="Center" ContentSource="Header"/>
                        </Border>
                        <Border Grid.Row="1" BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
                            <ContentPresenter ContentSource="Content"/>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="HeaderTemplate">
            <Setter.Value>
                <DataTemplate>
                    <TextBlock  Text="{Binding}" FontFamily="Segoe UI" FontWeight="Black" Foreground="White" Margin="10,4"/>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <SolidColorBrush x:Key="AxisMoveBg" Color="#4A90A4"/>
    <SolidColorBrush x:Key="AxisMoveHover" Color="#3F7E8B"/>
    <SolidColorBrush x:Key="AxisMovePressed" Color="#33666F"/>

    <!-- 轴移动按钮样式 -->
    <Style x:Key="AxisMoveButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
        <Setter Property="Background" Value="{StaticResource AxisMoveBg}"/>
        <Setter Property="BorderBrush" Value="{StaticResource AxisMoveBg}"/>
        <Setter Property="Foreground" Value="White"/>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{StaticResource AxisMoveHover}"/>
                <Setter Property="BorderBrush" Value="{StaticResource AxisMoveHover}"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Background" Value="{StaticResource AxisMovePressed}"/>
                <Setter Property="BorderBrush" Value="{StaticResource AxisMovePressed}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Background" Value="{StaticResource DisabledBackground}"/>
                <Setter Property="BorderBrush" Value="{StaticResource DisabledBackground}"/>
                <Setter Property="Foreground" Value="{StaticResource DisabledForeground}"/>
                <Setter Property="Cursor" Value="Arrow"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <!-- DataGrid错误提示样式 -->
    <Style x:Key="DataGridRowErrorStyle" TargetType="{x:Type DataGridRow}">
        <Setter Property="ValidationErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <DockPanel>
                        <!-- 在行左侧显示一个红色感叹号 -->
                        <TextBlock Foreground="Red" FontWeight="Bold" 
                               Text="!" DockPanel.Dock="Bottom" Margin="5,0,0,0"/>
                        <!-- 占位符，显示原始的行 -->
                        <AdornedElementPlaceholder />
                    </DockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <!-- 当行有错误时，设置工具提示 -->
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="True">
                <Setter Property="ToolTip" 
                    Value="{Binding RelativeSource={RelativeSource Self}, 
                                    Path=(Validation.Errors)[0].ErrorContent}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="ModernSwitchStyle" TargetType="{x:Type CheckBox}">
        <Setter Property="Foreground" Value="#CBD5E1"/>
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CheckBox}">
                    <StackPanel Orientation="Horizontal">
                        <Grid x:Name="SwitchRoot" Width="50" Height="20">
                            <Border x:Name="Track" 
                                        Background="#D7DDE4" 
                                        CornerRadius="10" 
                                        BorderThickness="0"/>
                            <Ellipse x:Name="Thumb" 
                                         Fill="White" 
                                         Width="16" 
                                         Height="16" 
                                         HorizontalAlignment="Left" 
                                         Margin="2,0,0,0">
                                <Ellipse.RenderTransform>
                                    <TranslateTransform X="0"/>
                                </Ellipse.RenderTransform>
                            </Ellipse>
                        </Grid>
                        <ContentPresenter Margin="8,0,0,0" VerticalAlignment="Center"/>
                    </StackPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Thumb" 
                                                             Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" 
                                                             To="30" Duration="0:0:0.2"/>
                                        <ColorAnimation Storyboard.TargetName="Track" 
                                                            Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" 
                                                            To="#10B981" Duration="0:0:0.2"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Thumb" 
                                                             Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" 
                                                             To="0" Duration="0:0:0.2"/>
                                        <ColorAnimation Storyboard.TargetName="Track" 
                                                            Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" 
                                                            To="#CBD5E1" Duration="0:0:0.2"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="SwitchRoot" Property="Opacity" Value="0.4"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>