InputElements.xaml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <ResourceDictionary
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  4. <ResourceDictionary.MergedDictionaries>
  5. <ResourceDictionary Source="/Resources/Common/Colors.xaml"/>
  6. </ResourceDictionary.MergedDictionaries>
  7. <Style x:Key="InputElement" TargetType="Control">
  8. <Setter Property="FontFamily" Value="微软雅黑" />
  9. <Setter Property="FontSize" Value="14" />
  10. <Setter Property="Height" Value="22" />
  11. <Setter Property="VerticalContentAlignment" Value="Center" />
  12. <Setter Property="Padding" Value="1" />
  13. </Style>
  14. <Style x:Key="TextBox" TargetType="TextBox" BasedOn="{StaticResource InputElement}">
  15. <Setter Property="MaxLength" Value="150"></Setter>
  16. <Style.Triggers>
  17. <Trigger Property="Validation.HasError" Value="true">
  18. <Setter Property="ToolTip"
  19. Value="{Binding RelativeSource={x:Static RelativeSource.Self},
  20. Path=(Validation.Errors)[0].ErrorContent}"/>
  21. </Trigger>
  22. </Style.Triggers>
  23. </Style>
  24. <Style TargetType="DatePickerTextBox" BasedOn="{StaticResource InputElement}">
  25. <Setter Property="IsReadOnly" Value="True"/>
  26. </Style>
  27. <Style TargetType="DatePicker" BasedOn="{StaticResource InputElement}">
  28. <Setter Property="Template">
  29. <Setter.Value>
  30. <ControlTemplate TargetType="{x:Type DatePicker}">
  31. <Grid x:Name="PART_Root">
  32. <Grid.ColumnDefinitions>
  33. <ColumnDefinition Width="*" />
  34. <ColumnDefinition Width="Auto" />
  35. </Grid.ColumnDefinitions>
  36. <DatePickerTextBox x:Name="PART_TextBox"
  37. BorderBrush="{TemplateBinding BorderBrush}"
  38. BorderThickness="{TemplateBinding BorderThickness}"
  39. HorizontalContentAlignment="Stretch"
  40. Padding="{TemplateBinding Padding}"
  41. VerticalContentAlignment="Center"
  42. Visibility="Visible"
  43. Grid.Column="0">
  44. </DatePickerTextBox>
  45. <Button x:Name="PART_Button">
  46. <Button.Style>
  47. <Style TargetType="{x:Type Button}">
  48. <Setter Property="Template">
  49. <Setter.Value>
  50. <ControlTemplate TargetType="{x:Type Button}">
  51. <Button x:Name="PART_Button" VerticalAlignment="Stretch">
  52. <Button.Style>
  53. <Style TargetType="{x:Type Button}">
  54. <Setter Property="OverridesDefaultStyle" Value="True"></Setter>
  55. <Setter Property="Template">
  56. <Setter.Value>
  57. <ControlTemplate TargetType="{x:Type Button}">
  58. <Border Background="{StaticResource module-primary-color-brush}"
  59. Height="Auto"
  60. HorizontalAlignment="Right"
  61. Width="{Binding Path=Height, RelativeSource={RelativeSource Mode=Self}}"
  62. Padding="4,0,4,0"
  63. >
  64. <Image Name="buttonImage"
  65. Source="../resources/images/calendar.png"
  66. Stretch="None"
  67. VerticalAlignment="Center">
  68. </Image>
  69. </Border>
  70. </ControlTemplate>
  71. </Setter.Value>
  72. </Setter>
  73. </Style>
  74. </Button.Style>
  75. </Button>
  76. </ControlTemplate>
  77. </Setter.Value>
  78. </Setter>
  79. </Style>
  80. </Button.Style>
  81. </Button>
  82. <Popup x:Name="PART_Popup" StaysOpen="False" AllowsTransparency="True" />
  83. </Grid>
  84. </ControlTemplate>
  85. </Setter.Value>
  86. </Setter>
  87. </Style>
  88. <Style x:Key="ComboBox" TargetType="ComboBox" BasedOn="{StaticResource InputElement}">
  89. </Style>
  90. <Style x:Key="TextArea" TargetType="TextBox" BasedOn="{StaticResource InputElement}">
  91. <Setter Property="Height" Value="80"/>
  92. <Setter Property="TextWrapping" Value="Wrap"/>
  93. <Setter Property="AcceptsReturn" Value="True"/>
  94. <Setter Property="Padding" Value="3" />
  95. <Setter Property="VerticalContentAlignment" Value="Top" />
  96. <Setter Property="MaxLength" Value="1500"></Setter>
  97. </Style>
  98. <Style x:Key="PasswordBox" TargetType="PasswordBox" BasedOn="{StaticResource InputElement}">
  99. <Setter Property="MaxLength" Value="150"></Setter>
  100. </Style>
  101. </ResourceDictionary>