|
- <Application x:Class="BPASmart.UserManagement.App"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:local="clr-namespace:BPASmart.UserManagement"
- StartupUri="MainWindow.xaml">
- <Application.Resources>
- <SolidColorBrush x:Key="commanTextblock" Color="#FF2AB2E7"/>
- <SolidColorBrush x:Key="selectedColor" Color=" #4169E1"/>
- <SolidColorBrush x:Key="ScrollBarDisabledBackground" Color="#F4F4F4"/>
- <!--#region ScrollViewer-->
-
- <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
- <Setter Property="OverridesDefaultStyle" Value="true"/>
- <Setter Property="IsTabStop" Value="false"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Thumb}">
- <!--滚动条颜色和圆角设置-->
- <Rectangle Name="thumbRect" Fill="#03ffea" RadiusX="3" RadiusY="3"/>
- <!--鼠标拉动滚动条时的颜色-->
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter Property="Fill" Value="CornflowerBlue" TargetName="thumbRect" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
- <Setter Property="SnapsToDevicePixels" Value="True" />
- <Setter Property="OverridesDefaultStyle" Value="true" />
- <Setter Property="IsTabStop" Value="false" />
- <Setter Property="Focusable" Value="false" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type RepeatButton}">
- <Border Background="Transparent" />
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
- <Grid>
- <Border CornerRadius="2" Width="0.5" Background="#FF046BFF" />
- <Track x:Name="PART_Track" IsDirectionReversed="true">
- <Track.DecreaseRepeatButton>
- <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageUpCommand" />
- </Track.DecreaseRepeatButton>
- <Track.Thumb>
- <Thumb Style="{StaticResource ScrollBarThumb}" Margin="4,0,4,0" Background="DodgerBlue"></Thumb>
- </Track.Thumb>
- <Track.IncreaseRepeatButton>
- <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageDownCommand" />
- </Track.IncreaseRepeatButton>
- </Track>
- </Grid>
- </ControlTemplate>
- <ControlTemplate x:Key="ScrollViewerControlTemplate1" TargetType="{x:Type ScrollViewer}">
- <Grid x:Name="Grid" Background="{TemplateBinding Background}">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="*"/>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
- <Rectangle x:Name="Corner" Grid.Column="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Row="1"/>
- <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
- <ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1"
- Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
- Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"
- Template="{StaticResource VerticalScrollBar}"/>
- <ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
- </Grid>
- </ControlTemplate>
- <ControlTemplate x:Key="MyScrollViewer" TargetType="{x:Type ScrollViewer}">
- <!--View区域背景色-->
- <Grid x:Name="Grid" Background="{TemplateBinding Background}">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="*"/>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
- <Rectangle x:Name="Corner" Grid.Column="1" Fill="White" Grid.Row="1"/>
- <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
- <ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" Style="{DynamicResource MyScrollBarStyle}"/>
- <ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}" Style="{DynamicResource MyScrollBarStyle}"/>
- </Grid>
- </ControlTemplate>
-
-
- <Style x:Key="VerticalScrollBarPageButton" TargetType="{x:Type RepeatButton}">
- <Setter Property="OverridesDefaultStyle" Value="true"/>
- <Setter Property="Background" Value="Transparent"/>
- <Setter Property="Focusable" Value="false"/>
- <Setter Property="IsTabStop" Value="false"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type RepeatButton}">
- <Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!--#endregion-->
-
- <!--#region右键菜单-->
- <Style TargetType="{x:Type ContextMenu}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ContextMenu}">
- <Border x:Name="Border" CornerRadius="4" Background="#1E2D45" BorderThickness="1" Margin="0"
- Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
- <Border.BorderBrush>
- <SolidColorBrush Color="#104E8B" />
- </Border.BorderBrush>
- <ItemsPresenter/>
- </Border>
- <ControlTemplate.Triggers>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsMouseOver" Value="True"/>
- </MultiTrigger.Conditions>
- <MultiTrigger.EnterActions>
- <BeginStoryboard>
- <Storyboard>
- <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Width)">
- <SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/>
- <SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="130"/>
- </DoubleAnimationUsingKeyFrames>
- <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Height)">
- <SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/>
- <SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="100"/>
- </DoubleAnimationUsingKeyFrames>
- </Storyboard>
- </BeginStoryboard>
- </MultiTrigger.EnterActions>
- </MultiTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style TargetType="{x:Type MenuItem}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type MenuItem}">
- <Border Margin="0,5,0,0" CornerRadius="5" >
- <Border.Background>
- <SolidColorBrush x:Name="MyAnimatedBrushBackground" Color="Transparent" />
- </Border.Background>
- <StackPanel Orientation="Horizontal">
- <TextBlock Text=" "/>
- <ContentPresenter ContentSource="Icon" HorizontalAlignment="Center" VerticalAlignment="Center" />
- <TextBlock Text=" "/>
- <ContentPresenter ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center"/>
- </StackPanel>
- </Border>
- <ControlTemplate.Triggers>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsMouseOver" Value="True"/>
- </MultiTrigger.Conditions>
- <MultiTrigger.EnterActions>
- <BeginStoryboard>
- <Storyboard>
- <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color">
- <LinearColorKeyFrame Value="#1E2D45" KeyTime="00:00:00.0020000" />
- <LinearColorKeyFrame Value="#05173B" KeyTime="00:00:00.320000" />
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- </BeginStoryboard>
- </MultiTrigger.EnterActions>
- <MultiTrigger.ExitActions>
- <BeginStoryboard>
- <Storyboard>
- <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color">
- <LinearColorKeyFrame Value="#05173B" KeyTime="00:00:00.0020000" />
- <LinearColorKeyFrame Value="#1E2D45" KeyTime="00:00:00.320000" />
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- </BeginStoryboard>
- </MultiTrigger.ExitActions>
- </MultiTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!--#endregion-->
-
- <!--#region button样式-->
- <Style x:Key="CommonButton" TargetType="{x:Type Button}">
- <Setter Property="Background" Value="Transparent"/>
- <Setter Property="Foreground" Value="#FF2AB2E7"/>
- <Setter Property="BorderBrush" Value="#FF2AB2E7"/>
- <Setter Property="FontFamily" Value="楷体"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Button}">
- <Border x:Name="border" CornerRadius="5" BorderThickness="1" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
- Padding="5,2">
- <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="border" Property="Background" Value="{DynamicResource selectedColor}"/>
- <Setter TargetName="border" Property="BorderBrush" Value="#F0FFFF"/>
- <Setter Property="Foreground" Value="white"/>
-
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="ButtonStyle" TargetType="Button">
- <Setter Property="Background" Value="Transparent"/>
- <Setter Property="Foreground" Value="#FF2AB2E7"/>
- <Setter Property="BorderBrush" Value="Transparent"/>
- <Setter Property="BorderThickness" Value="0"/>
- <Setter Property="FontSize" Value="14"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Button}">
- <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
- <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="border" Property="Background" Value="#442AB2E7"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="ButtontextStyle" TargetType="Button">
- <Setter Property="Background" Value="Transparent"/>
- <Setter Property="Foreground" Value="#FF2AB2E7"/>
- <Setter Property="BorderBrush" Value="Transparent"/>
- <Setter Property="BorderThickness" Value="0"/>
- <Setter Property="FontSize" Value="14"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Button}">
- <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
- <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="border" Property="Background" Value="Transparent"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <!--#endregion-->
-
- <!--#region 用户输入框样式-->
- <Style x:Key="UserTextBoxStyle" TargetType="TextBox">
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="CaretBrush" Value="#009DFF" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="TextBox">
- <Border
- x:Name="border"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="5"
- SnapsToDevicePixels="true">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="40" />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
- <TextBlock
- x:Name="PasswordTextBlock"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- FontFamily="../Fonts/#iconfont"
- FontSize="{TemplateBinding FontSize}"
- Foreground="{TemplateBinding BorderBrush}"
- Text=""/>
-
- <TextBlock
- Name="markText"
- Grid.Column="1"
- Margin="10,0"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- FontSize="{TemplateBinding FontSize}"
- Foreground="#88009dff"
- Text="请输入账号名称"
- Visibility="Collapsed" />
-
-
- <ScrollViewer
- x:Name="PART_ContentHost"
- Grid.Column="1"
- MinHeight="20"
- VerticalAlignment="Center"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </Grid>
-
- </Border>
-
- <ControlTemplate.Triggers>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsMouseOver" Value="false"/>
- <Condition Property="IsKeyboardFocused" Value="true"/>
- </MultiTrigger.Conditions>
- <MultiTrigger.Setters>
- <Setter TargetName="border" Property="BorderBrush" Value="#FF569DE5" />
- </MultiTrigger.Setters>
- </MultiTrigger>
- <Trigger Property="IsEnabled" Value="false">
- <Setter TargetName="border" Property="Opacity" Value="0.56" />
- </Trigger>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter TargetName="border" Property="BorderBrush" Value="#447EB4EA" />
- </Trigger>
- <!--<Trigger Property="IsKeyboardFocused" Value="true">
- <Setter TargetName="border" Property="BorderBrush" Value="#FF569DE5" />
- </Trigger>-->
- <DataTrigger Binding="{Binding Path=Text, RelativeSource={RelativeSource Mode=self}}" Value="">
- <Setter TargetName="markText" Property="Visibility" Value="Visible" />
- </DataTrigger>
- </ControlTemplate.Triggers>
-
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!--#endregion-->
-
- <!--#region 密码输入框样式-->
- <Style x:Key="PasswordBoxStyle" TargetType="{x:Type PasswordBox}">
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="FontFamily" Value="Times New Roman" />
- <Setter Property="PasswordChar" Value="●" />
- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
- <Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
- <Setter Property="HorizontalContentAlignment" Value="Left" />
- <Setter Property="Padding" Value="1" />
- <Setter Property="FocusVisualStyle" Value="{x:Null}" />
- <Setter Property="AllowDrop" Value="true" />
- <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
- <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
- <Setter Property="CaretBrush" Value="#009DFF" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type PasswordBox}">
- <Border
- x:Name="Bd"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="5"
- SnapsToDevicePixels="true">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="40" />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
- <TextBlock
- x:Name="UserTextBlock"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- FontFamily="../../Fonts/#iconfont"
- FontSize="{TemplateBinding FontSize}"
- Foreground="{TemplateBinding BorderBrush}"
- Text="" />
-
-
-
- <ScrollViewer
- x:Name="PART_ContentHost"
- Grid.Column="1"
- MinHeight="{TemplateBinding FontSize}"
- VerticalAlignment="Center"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </Grid>
-
- </Border>
- <ControlTemplate.Triggers>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsMouseOver" Value="false"/>
- <Condition Property="IsKeyboardFocused" Value="true"/>
- </MultiTrigger.Conditions>
- <MultiTrigger.Setters>
- <Setter TargetName="Bd" Property="BorderBrush" Value="#FF569DE5" />
- <Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF569DE5" />
- </MultiTrigger.Setters>
- </MultiTrigger>
- <Trigger Property="IsEnabled" Value="false">
- <Setter TargetName="Bd" Property="Opacity" Value="0.56" />
- <Setter TargetName="UserTextBlock" Property="Opacity" Value="0.56" />
- </Trigger>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter TargetName="Bd" Property="BorderBrush" Value="#447EB4EA" />
- <Setter TargetName="UserTextBlock" Property="Foreground" Value="#447EB4EA" />
- </Trigger>
- <!--<Trigger Property="IsKeyboardFocused" Value="true">
- <Setter TargetName="Bd" Property="BorderBrush" Value="#FF569DE5" />
- <Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF569DE5" />
- </Trigger>-->
-
-
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- <Style.Triggers>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsInactiveSelectionHighlightEnabled" Value="true" />
- <Condition Property="IsSelectionActive" Value="false" />
- </MultiTrigger.Conditions>
- <Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
- </MultiTrigger>
- </Style.Triggers>
- </Style>
- <!--#endregion-->
-
- <!--#region Combox-->
- <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
- <Grid Height="25" HorizontalAlignment="Stretch" Background="Transparent">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="30" />
- </Grid.ColumnDefinitions>
- <Border
- Grid.ColumnSpan="2"
- Background="White"
- Opacity="0" />
-
- <Path
- x:Name="Arrow"
- Grid.Column="1"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Data="M 0 0 6 6 12 0 Z"
- Fill="#FF2AB2E7"
- Stretch="None">
- <Path.Effect>
- <DropShadowEffect
- BlurRadius="10"
- Direction="90"
- Opacity="1"
- RenderingBias="Quality"
- ShadowDepth="0"
- Color="Transparent" />
- </Path.Effect>
- </Path>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsChecked" Value="true">
- <Setter TargetName="Arrow" Property="RenderTransform">
- <Setter.Value>
- <RotateTransform Angle="180" CenterX="6" CenterY="3" />
- </Setter.Value>
- </Setter>
- <Setter TargetName="Arrow" Property="Margin" Value="0,0,0,2" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
-
-
- <Style x:Key="CommonCombox" TargetType="{x:Type ComboBox}">
- <Setter Property="BorderThickness" Value="1" />
- <Setter Property="Background" Value=" #041039"/>
- <Setter Property="BorderBrush" Value="#FF2AB2E7"/>
- <Setter Property="BorderThickness" Value="1"/>
- <Setter Property="ItemContainerStyle">
- <Setter.Value>
- <Style TargetType="ComboBoxItem">
- <Setter Property="Height" Value="25" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ComboBoxItem}">
- <Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" >
- <Border x:Name="_borderbg" Background=" #041039" BorderBrush="#FF2AB2E7" BorderThickness="0"/>
- <TextBlock
- x:Name="_txt"
- Margin="5,0,3,0"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- Foreground="#FF2AB2E7"
- Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" />
-
- <Border
- x:Name="_border"
- Background="Transparent"
- Opacity="0" />
- </Grid>
- <ControlTemplate.Triggers>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsSelected" Value="false" />
- <Condition Property="IsMouseOver" Value="true" />
- </MultiTrigger.Conditions>
- <Setter TargetName="_borderbg" Property="Background" Value="#37405E" />
- <Setter TargetName="_borderbg" Property="BorderBrush" Value="white" />
- <Setter TargetName="_borderbg" Property="BorderThickness" Value="1" />
- <Setter TargetName="_txt" Property="Foreground" Value="white" />
- </MultiTrigger>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsSelected" Value="true" />
- </MultiTrigger.Conditions>
- <Setter TargetName="_borderbg" Property="Background" Value="#022352" />
- <Setter TargetName="_borderbg" Property="BorderBrush" Value=" #00BFFF" />
- <Setter TargetName="_borderbg" Property="BorderThickness" Value="1" />
- <Setter TargetName="_txt" Property="Foreground" Value="white" />
- </MultiTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Setter.Value>
- </Setter>
-
-
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ComboBox}">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="0.7*" />
- <ColumnDefinition Width="0.3*" MaxWidth="30" />
- </Grid.ColumnDefinitions>
- <Border
- x:Name="_prybr"
- Grid.Column="0"
- Grid.ColumnSpan="2"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="0" />
- <ContentPresenter
- x:Name="ContentSite"
- Margin="3,3,0,3"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Content="{TemplateBinding SelectionBoxItem}"
- ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
- ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
- IsHitTestVisible="False" />
-
- <!-- ToggleButton 已数据绑定到 ComboBox 本身以切换 IsDropDownOpen -->
- <ToggleButton
- Background="Transparent"
- x:Name="ToggleButton"
- Grid.Column="0"
- Grid.ColumnSpan="2"
- ClickMode="Press"
- Focusable="false"
- IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
- Template="{StaticResource ComboBoxToggleButton}" />
- <!-- 必须将 TextBox 命名为 PART_EditableTextBox,否则 ComboBox 将无法识别它 -->
- <TextBox
- x:Name="PART_EditableTextBox"
- Margin="2,0,0,0"
- VerticalAlignment="Center"
- Background="Transparent"
- BorderThickness="0"
- CaretBrush="{TemplateBinding Foreground}"
- Focusable="True"
- Foreground="{TemplateBinding Foreground}"
- IsReadOnly="{TemplateBinding IsReadOnly}"
- Visibility="Hidden" />
-
- <!-- Popup 可显示 ComboBox 中的项列表。IsOpen 已数据绑定到通过 ComboBoxToggleButton 来切换的 IsDropDownOpen -->
- <Popup
- x:Name="Popup"
- AllowsTransparency="True"
- Focusable="False"
- IsOpen="{TemplateBinding IsDropDownOpen}"
- Placement="Bottom"
- PopupAnimation="Slide">
- <Grid
- x:Name="DropDown"
- MinWidth="{TemplateBinding ActualWidth}"
- MaxHeight="150"
- SnapsToDevicePixels="True">
- <Border
- x:Name="DropDownBorder"
- BorderBrush="Black"
- BorderThickness="0" />
- <ScrollViewer
- Margin="1"
- CanContentScroll="True"
- HorizontalScrollBarVisibility="Hidden"
- SnapsToDevicePixels="True"
- VerticalScrollBarVisibility="Auto"
- Template="{DynamicResource MyScrollViewer }">
- <!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
- <!-- 一下可以设置列表背景色 -->
- <StackPanel
- Background="{TemplateBinding Background}"
- IsItemsHost="True"
- KeyboardNavigation.DirectionalNavigation="Contained"/>
- </ScrollViewer>
- </Grid>
- </Popup>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsEditable" Value="true">
- <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" />
- </Trigger>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="_prybr" Property="BorderBrush" Value="#aa3ba7f2" />
-
- </Trigger>
- <Trigger Property="IsEnabled" Value="False">
- <Setter TargetName="ContentSite" Property="Opacity" Value="0.6" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
-
- <!--滚动条颜色、圆角等设置-->
-
- <Style x:Key="HorizontalScrollBarPageButton" TargetType="{x:Type RepeatButton}">
- <Setter Property="OverridesDefaultStyle" Value="true"/>
- <Setter Property="Background" Value="Transparent"/>
- <Setter Property="Focusable" Value="false"/>
- <Setter Property="IsTabStop" Value="false"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type RepeatButton}">
- <Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="MyScrollBarStyle" TargetType="{x:Type ScrollBar}">
- <Setter Property="Background" Value="AliceBlue"/>
- <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
- <Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
- <!--滚动条宽度-->
- <Setter Property="Width" Value="8"/>
- <Setter Property="MinWidth" Value="6"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ScrollBar}">
- <!--滚动条背景色-->
- <Grid x:Name="Bg" Background="#001f55" SnapsToDevicePixels="true" Width="8">
- <Grid.RowDefinitions>
- <RowDefinition />
- </Grid.RowDefinitions>
- <Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}">
- <Track.DecreaseRepeatButton>
- <RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource VerticalScrollBarPageButton}"/>
- </Track.DecreaseRepeatButton>
- <Track.IncreaseRepeatButton>
- <RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource VerticalScrollBarPageButton}"/>
- </Track.IncreaseRepeatButton>
- <Track.Thumb>
- <Thumb Style="{StaticResource ScrollBarThumb}"/>
- </Track.Thumb>
- </Track>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsEnabled" Value="false">
- <Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- <Style.Triggers>
- <Trigger Property="Orientation" Value="Horizontal">
- <Setter Property="Width" Value="Auto"/>
- <Setter Property="MinWidth" Value="0"/>
- <Setter Property="Height" Value="6"/>
- <Setter Property="MinHeight" Value="6"/>
- <Setter Property="Background" Value="AliceBlue"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ScrollBar}">
- <Grid x:Name="Bg" Background="Red" SnapsToDevicePixels="true">
- <Grid.ColumnDefinitions>
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
- <Track x:Name="PART_Track" IsEnabled="{TemplateBinding IsMouseOver}">
- <Track.DecreaseRepeatButton>
- <RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/>
- </Track.DecreaseRepeatButton>
- <Track.IncreaseRepeatButton>
- <RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/>
- </Track.IncreaseRepeatButton>
- <Track.Thumb>
- <Thumb Style="{StaticResource ScrollBarThumb}" />
- </Track.Thumb>
- </Track>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsEnabled" Value="false">
- <Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Trigger>
- </Style.Triggers>
- </Style>
-
-
-
- <!--#endregion-->
-
-
-
- <Style x:Key="CommonTextBox" TargetType="{x:Type TextBox}">
- <Setter Property="Foreground" Value="Orange"/>
- <Setter Property="Background" Value="Transparent"/>
- <Setter Property="BorderBrush" Value="#FF2AB2E7"/>
- <Setter Property="VerticalContentAlignment" Value="Center"/>
- </Style>
- </Application.Resources>
- </Application>
|