-
Notifications
You must be signed in to change notification settings - Fork 0
/
BigIntegerUpDown.xaml
79 lines (74 loc) · 4.89 KB
/
BigIntegerUpDown.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<UserControl x:Class="BigIntegerUpDown"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Hailstone_6"
mc:Ignorable="d"
d:DesignHeight="32" d:DesignWidth="100">
<UserControl.Resources>
<local:BigIntToStringConverter x:Key="BigIntConverter"/>
<!-- THEME BASIC -->
<Color x:Key="ThemeColor">#40a6d1</Color>
<Color x:Key="ThemeRedColor">#d14040</Color>
<Color x:Key="ThemeColorDark">#3992b8</Color>
<Color x:Key="ThemeColorDarker">#FF688CAF</Color>
<Color x:Key="ThemeColorInactive">#4cd1ff</Color>
<Color x:Key="ThemeColorActive">#FF3BACDC</Color>
<SolidColorBrush x:Key="ThemeBrush" Color="{DynamicResource ThemeColor}"/>
<SolidColorBrush x:Key="ThemeBrushDark" Color="{DynamicResource ThemeColorDark}"/>
<SolidColorBrush x:Key="ThemeBrushDarker" Color="{DynamicResource ThemeColorDarker}"/>
<SolidColorBrush x:Key="ThemeBrushInactive" Color="{DynamicResource ThemeColorInactive}"/>
<SolidColorBrush x:Key="ThemeBrushActive" Color="{DynamicResource ThemeColorActive}"/>
<SolidColorBrush x:Key="ThemeRedBrush" Color="{DynamicResource ThemeRedColor}"/>
<SolidColorBrush x:Key="Theme_Brush_Bg" Color="White"/>
<SolidColorBrush x:Key="Theme_Brush_SilverBorder" Color="Silver"/>
<ControlTemplate x:Key="updown_button_style" TargetType="RepeatButton">
<Border x:Name="br" BorderThickness="0" BorderBrush="{DynamicResource ThemeBrushDark}" Background="{DynamicResource ThemeBrushInactive}" CornerRadius="0">
<ContentPresenter x:Name="cp" TextElement.Foreground="{TemplateBinding Foreground}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="br" Property="Background" Value="{DynamicResource ThemeBrushActive}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="br" Property="Background" Value="Silver"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style TargetType="RepeatButton">
<Setter Property="Template" Value="{StaticResource updown_button_style}"/>
</Style>
</UserControl.Resources>
<Border>
<Border.OpacityMask>
<VisualBrush>
<VisualBrush.Visual>
<Border Background="Black" SnapsToDevicePixels="True" CornerRadius="4" Width="{Binding ActualWidth, RelativeSource={RelativeSource FindAncestor, AncestorType=Border}}" Height="{Binding ActualHeight, RelativeSource={RelativeSource FindAncestor, AncestorType=Border}}"/>
</VisualBrush.Visual>
</VisualBrush>
</Border.OpacityMask>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="22"/>
</Grid.ColumnDefinitions>
<TextBox x:Name="TB" x:FieldModifier="private" FontWeight="Normal" Text="{Binding Path=Value,Converter={StaticResource BigIntConverter},Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" VerticalContentAlignment="Center" Padding="5,1" Grid.Column="0" Grid.RowSpan="2" PreviewMouseWheel="TB_MouseWheel" TextChanged="TB_TextChanged"/>
<RepeatButton x:Name="btnUp" x:FieldModifier="private" Grid.Column="1" Grid.Row="0" Width="auto" Height="auto" Click="cmdUp_Click">
<RepeatButton.Content>
<Path HorizontalAlignment="Center" VerticalAlignment="Center" Fill="Black" Data="M4,0 L0,4 L8,4 z"/>
</RepeatButton.Content>
</RepeatButton>
<RepeatButton x:Name="btnDown" x:FieldModifier="private" Grid.Column="1" Grid.Row="1" Width="auto" Height="auto" Click="cmdDown_Click">
<RepeatButton.Content>
<Path HorizontalAlignment="Center" VerticalAlignment="Center" Fill="Black" Data="M0,0 L8,0 L4,4 z"/>
</RepeatButton.Content>
</RepeatButton>
<Border BorderBrush="Gray" IsHitTestVisible="False" BorderThickness="1" CornerRadius="4" Grid.RowSpan="2" Grid.ColumnSpan="2" Padding="0" Margin="0"/>
</Grid>
</Border>
</UserControl>