IntegerSpinnner.xaml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <ResourceDictionary
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:local="clr-namespace:FWindSoft.Wpf.Controls"
  5. xmlns:wpf="clr-namespace:FWindSoft.Wpf">
  6. <Style TargetType="{x:Type local:IntegerSpinner}">
  7. <Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
  8. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  9. <Setter Property="AllowDrop" Value="true" />
  10. <Setter Property="Template">
  11. <Setter.Value>
  12. <ControlTemplate TargetType="{x:Type local:IntegerSpinner}">
  13. <Grid>
  14. <Border x:Name="Border" MinHeight="23" BorderThickness="1" Padding="0" BorderBrush="DarkGray" CornerRadius="2">
  15. <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0">
  16. <Grid.ColumnDefinitions>
  17. <ColumnDefinition Width="*" />
  18. <ColumnDefinition Width="20" />
  19. </Grid.ColumnDefinitions>
  20. <TextBox x:Name="PART_TextBox" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
  21. IsReadOnly="{TemplateBinding IsReadOnly}"
  22. BorderThickness="0"
  23. Background="Transparent"
  24. ContextMenu="{TemplateBinding ContextMenu}"
  25. FontFamily="{TemplateBinding FontFamily}"
  26. FontSize="{TemplateBinding FontSize}"
  27. FontStretch="{TemplateBinding FontStretch}"
  28. FontStyle="{TemplateBinding FontStyle}"
  29. FontWeight="{TemplateBinding FontWeight}"
  30. Foreground="{TemplateBinding Foreground}"
  31. HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
  32. IsTabStop="True"
  33. MinWidth="20"
  34. AcceptsReturn="False"
  35. Padding="{TemplateBinding Padding}"
  36. TextWrapping="NoWrap"></TextBox>
  37. <Grid Grid.Column="1" Width="20" VerticalAlignment="Stretch" HorizontalAlignment="Right" Margin="0">
  38. <Grid.RowDefinitions>
  39. <RowDefinition></RowDefinition>
  40. <RowDefinition></RowDefinition>
  41. </Grid.RowDefinitions>
  42. <Button x:Name="PART_Up" Grid.Row="0" IsEnabled="{TemplateBinding IsReadOnly,Converter={x:Static wpf:ConverterFactory.BoolOpposition}}" VerticalAlignment="Stretch" Padding="0">
  43. <Path HorizontalAlignment="Center" VerticalAlignment="Center" Fill="Black" Data="M 0 0 L 4 4 L 8 0 Z" RenderTransformOrigin="0.5,0.5">
  44. <Path.RenderTransform>
  45. <RotateTransform Angle="-180" />
  46. </Path.RenderTransform>
  47. </Path>
  48. </Button>
  49. <Button x:Name="PART_Down" Grid.Row="1" IsEnabled="{TemplateBinding IsReadOnly,Converter={x:Static wpf:ConverterFactory.BoolOpposition}}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Padding="0">
  50. <Path HorizontalAlignment="Center" VerticalAlignment="Center" Fill="Black" Data="M 0 0 L 4 4 L 8 0 Z" RenderTransformOrigin="0.5,0.5">
  51. <Path.RenderTransform>
  52. <RotateTransform Angle="0" />
  53. </Path.RenderTransform>
  54. </Path>
  55. </Button>
  56. </Grid>
  57. </Grid>
  58. </Border>
  59. </Grid>
  60. </ControlTemplate>
  61. </Setter.Value>
  62. </Setter>
  63. </Style>
  64. </ResourceDictionary>