| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit">
- <Style x:Key="BaseButtonStyle" TargetType="{x:Type ButtonBase}">
- <Setter Property="Background" Value="#FFCFCFCF" />
- <Setter Property="BorderBrush" Value="{DynamicResource CommonBorderBrush}" />
- <Setter Property="HorizontalContentAlignment" Value="Center" />
- <Setter Property="VerticalContentAlignment" Value="Center" />
- <Setter Property="Padding" Value="0,0,1,1" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ButtonBase}">
- <Border x:Name="ContentContainer"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- SnapsToDevicePixels="true">
- <ContentPresenter Margin="{TemplateBinding Padding}"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- RecognizesAccessKey="True"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsKeyboardFocused" Value="true" />
- <Trigger Property="Button.IsDefaulted" Value="true" />
- <Trigger Property="IsPressed" Value="true" />
- <Trigger Property="ToggleButton.IsChecked" Value="true" />
- <Trigger Property="IsEnabled" Value="false">
- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="RepeatSpinnerStyle"
- BasedOn="{StaticResource BaseButtonStyle}"
- TargetType="{x:Type RepeatButton}">
- <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
- </Style>
- <Style x:Key="ButtonNewSpinnerStyle" TargetType="{x:Type xctk:ButtonSpinner}">
- <Setter Property="BorderThickness" Value="1" />
- <Setter Property="IsTabStop" Value="False" />
- <Setter Property="HorizontalContentAlignment" Value="Stretch" />
- <Setter Property="VerticalContentAlignment" Value="Center" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type xctk:ButtonSpinner}">
- <Border x:Name="Border"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- SnapsToDevicePixels="True">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" MinWidth="20" />
- <ColumnDefinition Width="8*" />
- <ColumnDefinition Width="*" MinWidth="20" />
- </Grid.ColumnDefinitions>
- <RepeatButton x:Name="PART_DecreaseButton"
- BorderThickness="0,0,1,0"
- IsTabStop="{TemplateBinding IsTabStop}"
- Style="{DynamicResource RepeatSpinnerStyle}">
- <Path Width="10.25"
- Height="3.667"
- Margin="4"
- Data="F1M2,1C2,1 10,1 10,1 10,1 10,3 10,3 10,3 2,3 2,3 2,3 2,1 2,1z"
- Fill="{DynamicResource RepeaterContentBrush}"
- Stretch="Fill" />
- </RepeatButton>
- <ContentPresenter Grid.Column="1"
- Margin="{TemplateBinding Padding}"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- Content="{TemplateBinding Content}"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- <RepeatButton x:Name="PART_IncreaseButton"
- Grid.Column="2"
- BorderThickness="1,0,0,0"
- IsTabStop="{TemplateBinding IsTabStop}"
- Style="{DynamicResource RepeatSpinnerStyle}">
- <Path Width="10.917"
- Height="10.417"
- Margin="4"
- Data="F1M5,2C5,2 7,2 7,2 7,2 7,2.5 7,3.25L7,5 8.75,5C9.5,5 10,5 10,5 10,5 10,7 10,7 10,7 9.5,7 8.75,7L7,7 7,8.75C7,9.5 7,10 7,10 7,10 5,10 5,10 5,10 5,9.5 5,8.75L5,7 3.25,7C2.5,7 2,7 2,7 2,7 2,5 2,5 2,5 2.5,5 3.25,5L5,5 5,3.25C5,2.5,5,2,5,2z"
- Fill="{DynamicResource RepeaterContentBrush}"
- Stretch="Fill" />
- </RepeatButton>
- </Grid>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger SourceName="PART_IncreaseButton" Property="IsPressed" Value="True">
- <Setter TargetName="PART_IncreaseButton" Property="Background" Value="{DynamicResource ButtonPressBrush}" />
- </Trigger>
- <Trigger SourceName="PART_DecreaseButton" Property="IsPressed" Value="True">
- <Setter TargetName="PART_DecreaseButton" Property="Background" Value="{DynamicResource ButtonPressBrush}" />
- </Trigger>
- <Trigger SourceName="PART_IncreaseButton" Property="IsEnabled" Value="False" />
- <Trigger SourceName="PART_DecreaseButton" Property="IsEnabled" Value="False" />
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!-- 设置数字控件中的样式 -->
- <Style x:Key="WatermarkTextBoxStyle" TargetType="{x:Type xctk:WatermarkTextBox}">
- <Setter Property="AllowDrop" Value="True" />
- <Setter Property="HorizontalContentAlignment" Value="Center" />
- <Setter Property="FocusVisualStyle" Value="{x:Null}" />
- <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
- <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
- <Setter Property="WatermarkTemplate">
- <Setter.Value>
- <DataTemplate>
- <ContentControl Content="{Binding}" Focusable="False" />
- </DataTemplate>
- </Setter.Value>
- </Setter>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type xctk:WatermarkTextBox}">
- <Grid>
- <Border x:Name="Border"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="1" />
- <Border x:Name="MouseOverVisual"
- BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="1"
- Opacity="0">
- <Border.BorderBrush>
- <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
- <GradientStop Offset="0.05" Color="#FF5794BF" />
- <GradientStop Offset="0.07" Color="#FFB7D5EA" />
- <GradientStop Offset="1" Color="#FFC7E2F1" />
- </LinearGradientBrush>
- </Border.BorderBrush>
- </Border>
- <Border x:Name="FocusVisual"
- BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="1"
- Opacity="0">
- <Border.BorderBrush>
- <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
- <GradientStop Offset="0.05" Color="#FF3D7BAD" />
- <GradientStop Offset="0.07" Color="#FFA4C9E3" />
- <GradientStop Offset="1" Color="#FFB7D9ED" />
- </LinearGradientBrush>
- </Border.BorderBrush>
- </Border>
- <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- <ContentPresenter x:Name="PART_WatermarkHost"
- Margin="{TemplateBinding Padding}"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- Content="{TemplateBinding Watermark}"
- ContentTemplate="{TemplateBinding WatermarkTemplate}"
- IsHitTestVisible="False"
- Visibility="Collapsed" />
- </Grid>
- <ControlTemplate.Triggers>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsFocused" Value="False" />
- <Condition Property="Text" Value="" />
- </MultiTrigger.Conditions>
- <Setter TargetName="PART_WatermarkHost" Property="Visibility" Value="Visible" />
- </MultiTrigger>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="MouseOverVisual" Property="Opacity" Value="1" />
- </Trigger>
- <Trigger Property="IsFocused" Value="True">
- <Setter TargetName="FocusVisual" Property="Opacity" Value="1" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="DecimalNewUpDownStyle" TargetType="{x:Type xctk:DecimalUpDown}">
- <Setter Property="BorderThickness" Value="1" />
- <Setter Property="Padding" Value="0" />
- <Setter Property="BorderBrush" Value="{DynamicResource CommonBorderBrush}" />
- <Setter Property="ClipValueToMinMax" Value="True" />
- <Setter Property="HorizontalContentAlignment" Value="Center" />
- <Setter Property="IsTabStop" Value="False" />
- <Setter Property="VerticalContentAlignment" Value="Center" />
- <Setter Property="TextAlignment" Value="Right" />
- <Setter Property="Focusable" Value="True" />
- <Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
- <Setter Property="WatermarkTemplate">
- <Setter.Value>
- <DataTemplate>
- <ContentControl Margin="0,0,3,0"
- HorizontalContentAlignment="Center"
- Content="{Binding}"
- Focusable="False" />
- </DataTemplate>
- </Setter.Value>
- </Setter>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type xctk:DecimalUpDown}">
- <Grid>
- <Rectangle Name="OutSideBorder"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- SnapsToDevicePixels="true"
- Stroke="{DynamicResource FocusVisualBrush}"
- StrokeDashArray="1,2"
- StrokeThickness="1"
- Visibility="Collapsed" />
- <Border Margin="1"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="1"
- CornerRadius="4">
- <Grid>
- <xctk:ButtonSpinner x:Name="PART_Spinner"
- AllowSpin="{Binding AllowSpin,
- RelativeSource={RelativeSource TemplatedParent}}"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- ShowButtonSpinner="{Binding ShowButtonSpinner,
- RelativeSource={RelativeSource TemplatedParent}}"
- Style="{DynamicResource ButtonNewSpinnerStyle}">
- <xctk:WatermarkTextBox x:Name="PART_TextBox"
- MinWidth="20"
- HorizontalAlignment="Center"
- HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
- AcceptsReturn="False"
- AutoMoveFocus="{Binding AutoMoveFocus,
- RelativeSource={RelativeSource TemplatedParent}}"
- AutoSelectBehavior="{Binding AutoSelectBehavior,
- RelativeSource={RelativeSource TemplatedParent}}"
- Background="Transparent"
- BorderBrush="Transparent"
- BorderThickness="0"
- ContextMenu="{TemplateBinding ContextMenu}"
- FontFamily="{TemplateBinding FontFamily}"
- FontSize="{TemplateBinding FontSize}"
- FontStretch="{TemplateBinding FontStretch}"
- FontStyle="{TemplateBinding FontStyle}"
- FontWeight="{TemplateBinding FontWeight}"
- Foreground="{TemplateBinding Foreground}"
- IsReadOnly="{Binding IsReadOnly,
- RelativeSource={RelativeSource TemplatedParent}}"
- Padding="{TemplateBinding Padding}"
- SelectAllOnGotFocus="{Binding SelectAllOnGotFocus,
- RelativeSource={RelativeSource TemplatedParent}}"
- Style="{StaticResource WatermarkTextBoxStyle}"
- TabIndex="{TemplateBinding TabIndex}"
- TextAlignment="{Binding TextAlignment,
- RelativeSource={RelativeSource TemplatedParent}}"
- TextWrapping="NoWrap"
- Watermark="{Binding Watermark,
- RelativeSource={RelativeSource TemplatedParent}}"
- WatermarkTemplate="{Binding WatermarkTemplate,
- RelativeSource={RelativeSource TemplatedParent}}" />
- </xctk:ButtonSpinner>
- <Rectangle x:Name="enableRectangle"
- Grid.ColumnSpan="3"
- Fill="{DynamicResource MuchinfoBrush6}"
- Opacity="0.7"
- Visibility="Collapsed" />
- </Grid>
- </Border>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsEnabled" Value="False">
- <!-- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/> -->
- <Setter TargetName="enableRectangle" Property="Visibility" Value="Visible" />
- </Trigger>
- <Trigger Property="IsFocused" Value="True">
- <Setter TargetName="OutSideBorder" Property="Visibility" Value="Visible" />
- <Setter TargetName="PART_TextBox" Property="FocusManager.FocusedElement" Value="{Binding ElementName=PART_TextBox}" />
- </Trigger>
- <Trigger SourceName="PART_TextBox" Property="IsFocused" Value="True">
- <Setter TargetName="OutSideBorder" Property="Visibility" Value="Visible" />
- </Trigger>
- <Trigger SourceName="PART_Spinner" Property="IsFocused" Value="True">
- <Setter TargetName="OutSideBorder" Property="Visibility" Value="Visible" />
- <Setter TargetName="PART_TextBox" Property="FocusManager.FocusedElement" Value="{Binding ElementName=PART_TextBox}" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </ResourceDictionary>
|