整理
This commit is contained in:
165
NeuWPF/NeoUI/Controls/NumberBox.xaml
Normal file
165
NeuWPF/NeoUI/Controls/NumberBox.xaml
Normal file
@@ -0,0 +1,165 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:assists="clr-namespace:NeoUI.Assists"
|
||||
xmlns:converters="clr-namespace:NeoUI.Converters"
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:local="clr-namespace:NeoUI.Controls"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/NeoUI;component/Controls/ButtonsStyle.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!--<converters:PrecisionConverter x:Key="PrecisionConverter" />-->
|
||||
<!-- 内部按钮的样式 -->
|
||||
<!--<Style
|
||||
x:Key="NumberBoxButtonStyle"
|
||||
BasedOn="{StaticResource FlattenButton}"
|
||||
TargetType="Button">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#E6E6E6" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>-->
|
||||
|
||||
<Style TargetType="{x:Type local:NumberBox}">
|
||||
<!--<Setter Property="BorderThickness" Value="1"/>-->
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
||||
<Setter Property="Padding" Value="2" />
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<!--<Setter Property="BorderThickness" Value="0"/>-->
|
||||
<Setter Property="Background" Value="{DynamicResource BackgroundContainerBrush}" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type local:NumberBox}">
|
||||
<decorations:SlotBorder
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Intensity="0.2"
|
||||
x:Name="slot">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<!-- 前缀 -->
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<!-- 输入框 -->
|
||||
<ColumnDefinition Width="*" />
|
||||
<!-- 后缀 -->
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter
|
||||
Content="{TemplateBinding assists:InputAssist.Prefix}"
|
||||
Focusable="False"
|
||||
Grid.Column="0"
|
||||
Margin="1,0,5,0"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="Prefix" />
|
||||
<TextBox
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Grid.Column="1"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Padding="0"
|
||||
Style="{DynamicResource FlattenTextBox}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="PART_TextBox">
|
||||
<!--<TextBox.Text>
|
||||
<MultiBinding Converter="{StaticResource PrecisionConverter}" UpdateSourceTrigger="PropertyChanged">
|
||||
<Binding Path="Value" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||
<Binding Path="Precision" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||
</MultiBinding>
|
||||
</TextBox.Text>-->
|
||||
</TextBox>
|
||||
|
||||
<Border
|
||||
Background="Transparent"
|
||||
BorderBrush="{DynamicResource BorderNormalBrush}"
|
||||
BorderThickness="1,0,0,0"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="-2"
|
||||
x:Name="border">
|
||||
<Grid Width="20">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="1" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Button
|
||||
Content="▲"
|
||||
FontSize="8"
|
||||
Grid.Row="0"
|
||||
IsTabStop="False"
|
||||
Padding="0"
|
||||
Style="{DynamicResource FlattenButton}"
|
||||
assists:ControlAssist.CornerRadius="0,4,0,0"
|
||||
x:Name="PART_IncreaseButton" />
|
||||
<Rectangle
|
||||
Fill="{DynamicResource BorderNormalBrush}"
|
||||
Grid.Row="1"
|
||||
Height="1" />
|
||||
<Button
|
||||
Content="▼"
|
||||
FontSize="8"
|
||||
Grid.Row="2"
|
||||
IsTabStop="False"
|
||||
Padding="0"
|
||||
Style="{DynamicResource FlattenButton}"
|
||||
assists:ControlAssist.CornerRadius="0,0,4,0"
|
||||
x:Name="PART_DecreaseButton" />
|
||||
</Grid>
|
||||
</Border>
|
||||
<!-- Suffix -->
|
||||
<ContentPresenter
|
||||
Content="{TemplateBinding assists:InputAssist.Suffix}"
|
||||
Focusable="False"
|
||||
Grid.Column="2"
|
||||
Margin="5,0,1,0"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="Suffix" />
|
||||
</Grid>
|
||||
</decorations:SlotBorder>
|
||||
<ControlTemplate.Triggers>
|
||||
<!-- Prefix & Suffix -->
|
||||
<Trigger Property="Content" SourceName="Prefix" Value="{x:Null}">
|
||||
<Setter Property="Visibility" TargetName="Prefix" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<Trigger Property="Content" SourceName="Suffix" Value="{x:Null}">
|
||||
<Setter Property="Visibility" TargetName="Suffix" Value="Collapsed" />
|
||||
</Trigger>
|
||||
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="BorderBrush" Value="#40A9FF" />
|
||||
<!--<Setter TargetName="border" Property="Visibility" Value="Visible"/>-->
|
||||
</Trigger>
|
||||
<Trigger Property="IsKeyboardFocusWithin" Value="True">
|
||||
<Setter Property="BorderBrush" Value="#40A9FF" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter Property="ShaderEnabled" TargetName="slot" Value="False" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user