|
- <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:bpa="clr-namespace:BPA.UIControl"
- xmlns:system="clr-namespace:System;assembly=mscorlib">
-
- <ResourceDictionary.MergedDictionaries>
- <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/TextBox.xaml" />
- <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/RepeatButton.xaml" />
- </ResourceDictionary.MergedDictionaries>
-
- <Style x:Key="RubyerNumericBox" TargetType="{x:Type bpa:NumericBox}">
- <Setter Property="Background" Value="{DynamicResource ControlBackground}" />
- <Setter Property="BorderBrush" Value="{DynamicResource Border}" />
- <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
- <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
- <Setter Property="BorderThickness" Value="{DynamicResource DefaultBorderThickness}" />
- <Setter Property="Cursor" Value="IBeam" />
- <Setter Property="HorizontalContentAlignment" Value="Left" />
- <Setter Property="VerticalContentAlignment" Value="Center" />
- <Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
- <Setter Property="Validation.ErrorTemplate" Value="{StaticResource RubyerValidationErrorTemplate}" />
- <Setter Property="ShowButton" Value="True" />
- <Setter Property="MaxLength" Value="{x:Static system:Int32.MaxValue}" />
- <Setter Property="Interval" Value="1" />
- <Setter Property="NumericType" Value="Int" />
- <Setter Property="Padding" Value="0 5" />
- <Setter Property="MinValue" Value="{x:Static system:Double.MinValue}" />
- <Setter Property="MaxValue" Value="{x:Static system:Double.MaxValue}" />
- <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource AllControlCornerRadius}" />
- <Setter Property="bpa:ControlHelper.FocusBorderBrush" Value="{DynamicResource Primary}" />
- <Setter Property="bpa:ControlHelper.MouseOverBrush" Value="{DynamicResource Primary}" />
- <Setter Property="bpa:InputBoxHelper.IsClearable" Value="False" />
- <Setter Property="bpa:InputBoxHelper.PreContent" Value="{x:Null}" />
- <Setter Property="bpa:InputBoxHelper.Watermark" Value="{x:Null}" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type bpa:NumericBox}">
- <Grid x:Name="PART_Root">
- <TextBox x:Name="PART_TextBox"
- Style="{StaticResource RubyerTextBox}"
- Height="Auto"
- Padding="{TemplateBinding Padding}"
- HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
- bpa:ControlHelper.CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- bpa:ControlHelper.FocusBorderBrush="{Binding Path=(bpa:ControlHelper.FocusBorderBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- bpa:ControlHelper.MouseOverBrush="{Binding Path=(bpa:ControlHelper.MouseOverBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- bpa:InputBoxHelper.InternalSpacing="{Binding Path=(bpa:InputBoxHelper.InternalSpacing), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- bpa:InputBoxHelper.IsClearable="{Binding Path=(bpa:InputBoxHelper.IsClearable), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- bpa:InputBoxHelper.PreContent="{Binding Path=(bpa:InputBoxHelper.PreContent), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- bpa:InputBoxHelper.Watermark="{Binding Path=(bpa:InputBoxHelper.Watermark), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- Foreground="{TemplateBinding Foreground}"
- InputMethod.IsInputMethodEnabled="False"
- IsReadOnly="{TemplateBinding IsReadOnly}"
- MaxLength="{TemplateBinding MaxLength}">
- <bpa:InputBoxHelper.PostContent>
- <StackPanel Orientation="Horizontal">
- <ContentControl x:Name="PART_Content"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- Content="{Binding Path=(bpa:InputBoxHelper.PostContent), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
- <UniformGrid Height="28"
- Columns="1"
- Rows="2"
- Visibility="{TemplateBinding ShowButton, Converter={StaticResource BooleanToVisibleConverter}}">
- <RepeatButton x:Name="PART_IncreaseButton"
- Style="{StaticResource TextRepeatButton}"
- Padding="0"
- bpa:ControlHelper.CornerRadius="{DynamicResource TopControlCornerRadius}"
- Focusable="False"
- Foreground="{DynamicResource SeconarydText}">
- <bpa:Icon Type="ArrowUpSLine" />
- </RepeatButton>
- <RepeatButton x:Name="PART_DecreaseButton"
- Style="{StaticResource TextRepeatButton}"
- Padding="0"
- bpa:ControlHelper.CornerRadius="{DynamicResource BottomControlCornerRadius}"
- Focusable="False"
- Foreground="{DynamicResource SeconarydText}">
- <bpa:Icon Type="ArrowDownSLine" />
- </RepeatButton>
- </UniformGrid>
- </StackPanel>
- </bpa:InputBoxHelper.PostContent>
- </TextBox>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="Validation.HasError" Value="True">
- <Setter TargetName="PART_TextBox" Property="bpa:ControlHelper.FocusBorderBrush" Value="{DynamicResource Error}" />
- <Setter TargetName="PART_TextBox" Property="bpa:ControlHelper.MouseOverBrush" Value="{DynamicResource Error}" />
- <Setter TargetName="PART_TextBox" Property="BorderBrush" Value="{DynamicResource Error}" />
- </Trigger>
-
- <Trigger Property="bpa:InputBoxHelper.IsRound" Value="True">
- <Setter Property="bpa:ControlHelper.CornerRadius" Value="{Binding ActualHeight, RelativeSource={RelativeSource Self}, Converter={StaticResource HalfOfDoubleConverter}}" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <Style x:Key="FrontBackNumericBox"
- BasedOn="{StaticResource RubyerNumericBox}"
- TargetType="{x:Type bpa:NumericBox}">
- <Setter Property="bpa:ControlHelper.CornerRadius" Value="0" />
- <Setter Property="bpa:ControlHelper.FocusedForegroundBrush" Value="{DynamicResource WhiteForeground}" />
- <!--<Setter Property="BorderThickness" Value="0 1" />-->
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type bpa:NumericBox}">
- <Grid x:Name="PART_Root">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
- <TextBox x:Name="PART_TextBox"
- Style="{StaticResource RubyerTextBox}"
- Grid.Column="1"
- Height="Auto"
- Padding="{TemplateBinding Padding}"
- HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
- bpa:ControlHelper.CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- bpa:ControlHelper.FocusBorderBrush="{Binding Path=(bpa:ControlHelper.FocusBorderBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- bpa:ControlHelper.MouseOverBrush="{Binding Path=(bpa:ControlHelper.MouseOverBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- bpa:InputBoxHelper.InternalSpacing="{Binding Path=(bpa:InputBoxHelper.InternalSpacing), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- bpa:InputBoxHelper.IsClearable="{Binding Path=(bpa:InputBoxHelper.IsClearable), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- bpa:InputBoxHelper.PostContent="{Binding Path=(bpa:InputBoxHelper.PostContent), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- bpa:InputBoxHelper.PreContent="{Binding Path=(bpa:InputBoxHelper.PreContent), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- bpa:InputBoxHelper.Watermark="{Binding Path=(bpa:InputBoxHelper.Watermark), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- Focusable="{TemplateBinding Focusable}"
- Foreground="{TemplateBinding Foreground}"
- InputMethod.IsInputMethodEnabled="False"
- IsReadOnly="{TemplateBinding IsReadOnly}"
- MaxLength="{TemplateBinding MaxLength}" />
- <RepeatButton x:Name="PART_DecreaseButton"
- Height="Auto"
- Padding="5"
- VerticalAlignment="Stretch"
- bpa:ControlHelper.CornerRadius="{DynamicResource LeftControlCornerRadius}"
- Background="{Binding Path=(bpa:ControlHelper.FocusBorderBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- Focusable="False"
- Foreground="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- Visibility="{TemplateBinding ShowButton, Converter={StaticResource BooleanToVisibleConverter}}">
- <bpa:Icon Type="SubtractLine" />
- </RepeatButton>
- <RepeatButton x:Name="PART_IncreaseButton"
- Grid.Column="2"
- Height="Auto"
- Padding="5"
- VerticalAlignment="Stretch"
- bpa:ControlHelper.CornerRadius="{DynamicResource RightControlCornerRadius}"
- Background="{Binding Path=(bpa:ControlHelper.FocusBorderBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- Focusable="False"
- Foreground="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- Visibility="{TemplateBinding ShowButton, Converter={StaticResource BooleanToVisibleConverter}}">
- <bpa:Icon Type="AddLine" />
- </RepeatButton>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="Validation.HasError" Value="True">
- <Setter TargetName="PART_TextBox" Property="bpa:ControlHelper.FocusBorderBrush" Value="{DynamicResource Error}" />
- <Setter TargetName="PART_TextBox" Property="bpa:ControlHelper.MouseOverBrush" Value="{DynamicResource Error}" />
- <Setter TargetName="PART_TextBox" Property="BorderBrush" Value="{DynamicResource Error}" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <!-- Filled NumericBox -->
- <Style x:Key="FilledNumericBox"
- BasedOn="{StaticResource RubyerNumericBox}"
- TargetType="{x:Type bpa:NumericBox}">
- <Setter Property="BorderBrush" Value="{DynamicResource BorderLighter}" />
- <Setter Property="Background" Value="{DynamicResource BorderLighter}" />
- <Setter Property="bpa:ControlHelper.MouseOverBrush" Value="{DynamicResource BorderLight}" />
- </Style>
- </ResourceDictionary>
|