NumericUpDown.xaml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <UserControl
  2. x:Class="PDF_Office.CustomControl.NumericUpDown"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:PDF_Office.CustomControl"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. d:DesignHeight="32"
  9. d:DesignWidth="80"
  10. FontSize="20"
  11. mc:Ignorable="d">
  12. <Border>
  13. <Grid>
  14. <Grid.ColumnDefinitions>
  15. <ColumnDefinition Width="*" />
  16. <ColumnDefinition Width="auto" />
  17. </Grid.ColumnDefinitions>
  18. <TextBox
  19. Name="TextBox_Num"
  20. MinWidth="80"
  21. MinHeight="32"
  22. Padding="16,0,0,0"
  23. VerticalContentAlignment="Center"
  24. Background="Transparent"
  25. BorderThickness="0"
  26. FontFamily="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=FontFamily}"
  27. FontSize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=FontSize}"
  28. Foreground="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=Foreground}"
  29. InputMethod.IsInputMethodEnabled="False"
  30. PreviewTextInput="CountTextBox_PreviewTextInput"
  31. Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=Text}"
  32. TextAlignment="Left"
  33. TextChanged="TextBox_Num_TextChanged">
  34. <TextBox.Template>
  35. <ControlTemplate TargetType="{x:Type TextBox}">
  36. <Border BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="1,1,0,1" CornerRadius="4,0,0,4" Background="{StaticResource color.field.bg.def}">
  37. <ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
  38. </Border>
  39. </ControlTemplate>
  40. </TextBox.Template>
  41. </TextBox>
  42. <Grid Grid.Column="1" Width="16">
  43. <Grid.RowDefinitions>
  44. <RowDefinition />
  45. <RowDefinition />
  46. </Grid.RowDefinitions>
  47. <Button
  48. Name="Button_Add"
  49. Grid.Row="0"
  50. Background="Transparent"
  51. BorderBrush="Transparent"
  52. BorderThickness="0"
  53. Click="Button_Add_Click">
  54. <Path
  55. HorizontalAlignment="Center"
  56. Data="M10 5.93571L13.9696 9.90532L15.0303 8.84466L10.5303 4.34472C10.2374 4.05183 9.76257 4.05183 9.46967 4.34472L4.96974 8.84466L6.0304 9.90532L10 5.93571Z"
  57. Fill="{StaticResource color.icon.arrow.gray.def}"
  58. Stretch="Uniform"
  59. Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=ShowBtn}" />
  60. <Button.Template>
  61. <ControlTemplate TargetType="{x:Type Button}">
  62. <Border BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="1,1,1,0.5" CornerRadius="0,4,0,0" Background="{StaticResource color.field.bg.def}">
  63. <ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
  64. </Border>
  65. </ControlTemplate>
  66. </Button.Template>
  67. </Button>
  68. <Button
  69. Name="Button_Sub"
  70. Grid.Row="1"
  71. Background="Transparent"
  72. BorderThickness="00"
  73. Click="Button_Sub_Click">
  74. <Path
  75. Data="M10 9.06427L6.03039 5.09467L4.96973 6.15533L9.46967 10.6553C9.76256 10.9482 10.2374 10.9482 10.5303 10.6553L15.0303 6.15533L13.9696 5.09467L10 9.06427Z"
  76. Fill="{StaticResource color.icon.arrow.gray.def}"
  77. Stretch="Uniform"
  78. Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=ShowBtn}" />
  79. <Button.Template>
  80. <ControlTemplate TargetType="{x:Type Button}">
  81. <Border BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="1,0.5,1,1" CornerRadius="0,0,4,0" Background="{StaticResource color.field.bg.def}">
  82. <ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
  83. </Border>
  84. </ControlTemplate>
  85. </Button.Template>
  86. </Button>
  87. </Grid>
  88. </Grid>
  89. </Border>
  90. </UserControl>