终端一体化运控平台
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

MaterialConfigure.xaml 15 KiB

2 år sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <Window x:Class="BPASmart.RecipeManagement.View.MaterialConfigure"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:local="clr-namespace:BPASmart.RecipeManagement.View"
  7. xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel"
  8. mc:Ignorable="d"
  9. Title="MaterialConfigure" Height="300" Width="500" WindowStartupLocation="CenterScreen" WindowStyle="None" Background="White" MouseLeftButtonDown="Window_MouseLeftButtonDown">
  10. <Window.DataContext>
  11. <vm:MaterialConfigureViewModel/>
  12. </Window.DataContext>
  13. <Window.Resources>
  14. <Style TargetType="{x:Type ComboBox}">
  15. <Setter Property="Background" Value="White"/>
  16. <Setter Property="ItemContainerStyle">
  17. <Setter.Value>
  18. <!--ComBoxItem-->
  19. <Style TargetType="ComboBoxItem">
  20. <Setter Property="MinHeight" Value="22"></Setter>
  21. <Setter Property="MinWidth" Value="60"></Setter>
  22. <Setter Property="Template">
  23. <Setter.Value>
  24. <ControlTemplate TargetType="ComboBoxItem">
  25. <Border Name="Back" Background="Transparent" BorderThickness="0,0,0,0" BorderBrush="#81D779" >
  26. <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0,0,0"></ContentPresenter>
  27. </Border>
  28. <ControlTemplate.Triggers>
  29. <Trigger Property="IsMouseOver" Value="True">
  30. <Setter TargetName="Back" Property="Background" Value="LightGray"></Setter>
  31. </Trigger>
  32. <Trigger Property="IsHighlighted" Value="True">
  33. <Setter TargetName="Back" Property="Background" Value="LightGray"></Setter>
  34. </Trigger>
  35. </ControlTemplate.Triggers>
  36. </ControlTemplate>
  37. </Setter.Value>
  38. </Setter>
  39. </Style>
  40. </Setter.Value>
  41. </Setter>
  42. <Setter Property="Template">
  43. <Setter.Value>
  44. <ControlTemplate TargetType="{x:Type ComboBox}">
  45. <Border BorderThickness="1" BorderBrush="#CDC9C9 " CornerRadius="3" Width="{TemplateBinding Width}" Height="40" Background="{TemplateBinding Background}" >
  46. <Grid >
  47. <Grid.ColumnDefinitions>
  48. <ColumnDefinition Width="3*"/>
  49. <ColumnDefinition Width="*"/>
  50. </Grid.ColumnDefinitions>
  51. <Grid Grid.Column="0" x:Name="grid">
  52. <ToggleButton
  53. Width="{Binding ElementName=grid,Path=ActualWidth}"
  54. Height="{Binding ElementName=grid, Path=ActualHeight}"
  55. Content="{TemplateBinding Text}" VerticalAlignment="Center"
  56. HorizontalAlignment="Left" Margin="5,0,0,0"
  57. BorderThickness="0"
  58. Foreground="{TemplateBinding Foreground}"
  59. Background="{TemplateBinding Background}"
  60. IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"
  61. >
  62. <ToggleButton.Style >
  63. <Style TargetType="ToggleButton">
  64. <Setter Property="Background" Value="White"/>
  65. <Setter Property="Template">
  66. <Setter.Value>
  67. <ControlTemplate TargetType="ToggleButton">
  68. <Border Background="{TemplateBinding Background}" BorderThickness="0" >
  69. <TextBlock Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Content}" Margin="4 0 0 0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
  70. </Border>
  71. </ControlTemplate>
  72. </Setter.Value>
  73. </Setter>
  74. <Style.Triggers>
  75. <Trigger Property="IsMouseOver" Value="True">
  76. <Setter Property="Background" Value="White"/>
  77. </Trigger>
  78. <Trigger Property="IsMouseOver" Value="False">
  79. <Setter Property="Background" Value="White"/>
  80. </Trigger>
  81. </Style.Triggers>
  82. </Style>
  83. </ToggleButton.Style>
  84. </ToggleButton>
  85. </Grid>
  86. <Grid Grid.Column="1" >
  87. <ToggleButton IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
  88. Foreground="{TemplateBinding Foreground}"
  89. ClickMode="Press">
  90. <ToggleButton.Style>
  91. <Style TargetType="ToggleButton">
  92. <Setter Property="Background" Value="White"/>
  93. <Setter Property="Template">
  94. <Setter.Value>
  95. <ControlTemplate TargetType="ToggleButton">
  96. <Border Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}">
  97. <Grid>
  98. <Image Source="pack://application:,,,/image/down,png" Stretch="Fill" HorizontalAlignment="Center" VerticalAlignment="Center">
  99. <Image.RenderTransform>
  100. <TransformGroup>
  101. <ScaleTransform/>
  102. <SkewTransform/>
  103. <RotateTransform/>
  104. <TranslateTransform/>
  105. </TransformGroup>
  106. </Image.RenderTransform>
  107. </Image>
  108. </Grid>
  109. </Border>
  110. <!--<ControlTemplate.Triggers>
  111. <Trigger Property="IsChecked" Value="True">
  112. </Trigger>
  113. <EventTrigger RoutedEvent="Checked">
  114. <BeginStoryboard>
  115. <Storyboard >
  116. <DoubleAnimationUsingKeyFrames Storyboard.TargetName="arrow_tb" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
  117. <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
  118. <EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="180"/>
  119. </DoubleAnimationUsingKeyFrames>
  120. </Storyboard>
  121. </BeginStoryboard>
  122. </EventTrigger>
  123. <EventTrigger RoutedEvent="Unchecked">
  124. <BeginStoryboard>
  125. <Storyboard >
  126. <DoubleAnimationUsingKeyFrames Storyboard.TargetName="arrow_tb" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
  127. <EasingDoubleKeyFrame KeyTime="00:00:00" Value="180"/>
  128. <EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/>
  129. </DoubleAnimationUsingKeyFrames>
  130. </Storyboard>
  131. </BeginStoryboard>
  132. </EventTrigger>
  133. </ControlTemplate.Triggers>-->
  134. </ControlTemplate>
  135. </Setter.Value>
  136. </Setter>
  137. </Style>
  138. </ToggleButton.Style>
  139. </ToggleButton>
  140. </Grid>
  141. <Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="True" PopupAnimation="Slide">
  142. <Border CornerRadius="1" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True">
  143. <Border.Effect>
  144. <DropShadowEffect Color="Black" BlurRadius="2" ShadowDepth="0" Opacity="0.5"/>
  145. </Border.Effect>
  146. <ScrollViewer Margin="4,6,4,6" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
  147. <!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
  148. <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" Background="White"/>
  149. </ScrollViewer>
  150. </Border>
  151. </Popup>
  152. </Grid>
  153. <Border.Effect>
  154. <DropShadowEffect ShadowDepth="-1" Opacity="0.3" Color="#FF969696" BlurRadius="5"/>
  155. </Border.Effect>
  156. </Border>
  157. </ControlTemplate>
  158. </Setter.Value>
  159. </Setter>
  160. </Style>
  161. </Window.Resources>
  162. <Border CornerRadius="20" Background="#FFFAFA">
  163. <Grid>
  164. <Grid.ColumnDefinitions>
  165. <ColumnDefinition Width="17*"/>
  166. <ColumnDefinition Width="33*"/>
  167. </Grid.ColumnDefinitions>
  168. <Grid.RowDefinitions>
  169. <RowDefinition/>
  170. <RowDefinition />
  171. <RowDefinition />
  172. <RowDefinition Height="40"/>
  173. <RowDefinition />
  174. </Grid.RowDefinitions>
  175. <TextBlock Text="原料名称:" FontSize="22"
  176. HorizontalAlignment="Center" VerticalAlignment="Center" Height="28" Width="92"/>
  177. <TextBlock Text="原料种类:" FontSize="22" Grid.Row="1"
  178. HorizontalAlignment="Center" VerticalAlignment="Center" Height="28" Width="92"/>
  179. <TextBlock Text="原料位置:" FontSize="22" Grid.Row="2"
  180. HorizontalAlignment="Center" VerticalAlignment="Center" Height="28" Width="92"/>
  181. <TextBox Text="{Binding MaterialName}" FontSize="22" Grid.Column="1" Width="200" Height="40"
  182. VerticalAlignment="Center" HorizontalAlignment="Center"
  183. VerticalContentAlignment="Center"/>
  184. <ComboBox ItemsSource="{Binding MaterialTypes}"
  185. FontSize="18"
  186. Grid.Column="1" Grid.Row="1" Width="200" Height="40"
  187. SelectedItem="{Binding MaterialType}"/>
  188. <TextBox Text="{Binding MaterialPosion}" FontSize="22" Grid.Column="1" Grid.Row="2"
  189. Width="100" Height="40"
  190. VerticalAlignment="Center" HorizontalAlignment="Center"
  191. VerticalContentAlignment="Center"/>
  192. <TextBlock Text="{Binding ErrorMessage}" Grid.Row="3" Grid.ColumnSpan=" 2"
  193. Foreground="Red" VerticalAlignment="Center" HorizontalAlignment="Center"/>
  194. <StackPanel Grid.Row="4" Grid.ColumnSpan="2" Orientation="Horizontal"
  195. HorizontalAlignment="Center" VerticalAlignment="Center">
  196. <Button Content="保存" Foreground="White" FontSize="22" Width="120" Height="40" Margin="10" Background="#58B0ED"
  197. Command="{Binding SaveCommand}"/>
  198. <Button Content="取消" Foreground="White" FontSize="22" Width="120" Height="40" Margin="10" Background="#58B0ED"
  199. Click="Button_Click"/>
  200. </StackPanel>
  201. </Grid>
  202. </Border>
  203. </Window>