NumericUpDown.xaml 5.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. <Border BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="1,1,0,1" CornerRadius="4,0,0,4" Background="{StaticResource color.field.bg.def}"></Border>
  19. <TextBox
  20. Name="TextBox_Num"
  21. MinWidth="80"
  22. MinHeight="32"
  23. Padding="16,0,0,0"
  24. VerticalContentAlignment="Center"
  25. Background="Transparent"
  26. BorderThickness="0"
  27. FontFamily="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=FontFamily}"
  28. FontSize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=FontSize}"
  29. Foreground="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=Foreground}"
  30. InputMethod.IsInputMethodEnabled="False"
  31. PreviewTextInput="CountTextBox_PreviewTextInput"
  32. Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=Text}"
  33. TextAlignment="Left"
  34. TextChanged="TextBox_Num_TextChanged">
  35. <!--<TextBox.Template>
  36. <ControlTemplate TargetType="{x:Type TextBox}">
  37. <Border BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="1,1,0,1" CornerRadius="4,0,0,4" Background="{StaticResource color.field.bg.def}">
  38. <ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
  39. </Border>
  40. </ControlTemplate>
  41. </TextBox.Template>-->
  42. </TextBox>
  43. <Grid Grid.Column="1" Width="16">
  44. <Grid.RowDefinitions>
  45. <RowDefinition />
  46. <RowDefinition />
  47. </Grid.RowDefinitions>
  48. <Border Grid.Row="0" BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="1,1,1,0.5" CornerRadius="0,4,0,0" Background="{StaticResource color.field.bg.def}">
  49. <Button
  50. Name="Button_Add"
  51. Background="Transparent"
  52. BorderBrush="Transparent"
  53. BorderThickness="0"
  54. Click="Button_Add_Click">
  55. <Path
  56. HorizontalAlignment="Center"
  57. 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"
  58. Fill="{StaticResource color.icon.arrow.gray.def}"
  59. Stretch="Uniform"
  60. Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=ShowBtn}" />
  61. <!--<Button.Template>
  62. <ControlTemplate TargetType="{x:Type Button}">
  63. <Border BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="1,1,1,0.5" CornerRadius="0,4,0,0" Background="{StaticResource color.field.bg.def}">
  64. <ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
  65. </Border>
  66. </ControlTemplate>
  67. </Button.Template>-->
  68. </Button>
  69. </Border>
  70. <Border Grid.Row="1" BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="1,0.5,1,1" CornerRadius="0,0,4,0" Background="{StaticResource color.field.bg.def}">
  71. <Button
  72. Name="Button_Sub"
  73. Background="Transparent"
  74. BorderThickness="00"
  75. Click="Button_Sub_Click">
  76. <Path
  77. 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"
  78. Fill="{StaticResource color.icon.arrow.gray.def}"
  79. Stretch="Uniform"
  80. Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=ShowBtn}" />
  81. <!--<Button.Template>
  82. <ControlTemplate TargetType="{x:Type Button}">
  83. <Border BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="1,0.5,1,1" CornerRadius="0,0,4,0" Background="{StaticResource color.field.bg.def}">
  84. <ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
  85. </Border>
  86. </ControlTemplate>
  87. </Button.Template>-->
  88. </Button>
  89. </Border>
  90. </Grid>
  91. </Grid>
  92. </Border>
  93. </UserControl>