终端一体化运控平台
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

462 行
30 KiB

  1. <Window
  2. x:Class="FryPot_DosingSystem.View.NewRecipeView"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:Themes1="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:local="clr-namespace:FryPot_DosingSystem.View"
  8. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  9. xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel"
  10. Title="NewRecipeView"
  11. Width="800"
  12. Height="550"
  13. AllowsTransparency="True"
  14. WindowStartupLocation="CenterScreen"
  15. WindowStyle="None"
  16. mc:Ignorable="d">
  17. <Window.DataContext>
  18. <vm:NewRecipeViewModel />
  19. </Window.DataContext>
  20. <Window.Resources>
  21. <ResourceDictionary>
  22. <ResourceDictionary.MergedDictionaries>
  23. <ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
  24. <ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
  25. <ResourceDictionary>
  26. <!--#region ListBox样式-->
  27. <Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
  28. <Setter Property="OverridesDefaultStyle" Value="True" />
  29. <Setter Property="SnapsToDevicePixels" Value="True" />
  30. <Setter Property="BorderBrush" Value="{x:Null}" />
  31. <Setter Property="Foreground" Value="White" />
  32. <Setter Property="FontSize" Value="20" />
  33. <Setter Property="HorizontalContentAlignment" Value="Center" />
  34. <Setter Property="VerticalContentAlignment" Value="Center" />
  35. <Setter Property="Template">
  36. <Setter.Value>
  37. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  38. <Border x:Name="border" CornerRadius="8">
  39. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  40. </Border>
  41. </ControlTemplate>
  42. </Setter.Value>
  43. </Setter>
  44. </Style>
  45. <!--#endregion-->
  46. </ResourceDictionary>
  47. </ResourceDictionary.MergedDictionaries>
  48. <SolidColorBrush x:Key="TextBox.Static.Border" Color="#FFABAdB3" />
  49. <SolidColorBrush x:Key="TextBox.MouseOver.Border" Color="#FF7EB4EA" />
  50. <SolidColorBrush x:Key="TextBox.Focus.Border" Color="#FF569DE5" />
  51. <Style x:Key="TextBoxStyle" TargetType="{x:Type TextBox}">
  52. <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
  53. <Setter Property="BorderBrush" Value="{StaticResource TextBox.Static.Border}" />
  54. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
  55. <Setter Property="BorderThickness" Value="1" />
  56. <Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
  57. <Setter Property="HorizontalContentAlignment" Value="Left" />
  58. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  59. <Setter Property="AllowDrop" Value="true" />
  60. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
  61. <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
  62. <Setter Property="Template">
  63. <Setter.Value>
  64. <ControlTemplate TargetType="{x:Type TextBox}">
  65. <Border
  66. x:Name="border"
  67. Background="{TemplateBinding Background}"
  68. BorderBrush="{TemplateBinding BorderBrush}"
  69. BorderThickness="{TemplateBinding BorderThickness}"
  70. SnapsToDevicePixels="True">
  71. <ScrollViewer
  72. x:Name="PART_ContentHost"
  73. Focusable="false"
  74. HorizontalScrollBarVisibility="Hidden"
  75. VerticalScrollBarVisibility="Hidden" />
  76. </Border>
  77. <ControlTemplate.Triggers>
  78. <Trigger Property="IsEnabled" Value="false">
  79. <Setter TargetName="border" Property="Opacity" Value="0.56" />
  80. </Trigger>
  81. <Trigger Property="IsMouseOver" Value="true">
  82. <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource TextBox.MouseOver.Border}" />
  83. </Trigger>
  84. <Trigger Property="IsKeyboardFocused" Value="true">
  85. <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource TextBox.Focus.Border}" />
  86. </Trigger>
  87. </ControlTemplate.Triggers>
  88. </ControlTemplate>
  89. </Setter.Value>
  90. </Setter>
  91. <Style.Triggers>
  92. <MultiTrigger>
  93. <MultiTrigger.Conditions>
  94. <Condition Property="IsInactiveSelectionHighlightEnabled" Value="true" />
  95. <Condition Property="IsSelectionActive" Value="false" />
  96. </MultiTrigger.Conditions>
  97. <Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
  98. </MultiTrigger>
  99. </Style.Triggers>
  100. </Style>
  101. <SolidColorBrush x:Key="foreground" Color="#a2c2e8" />
  102. <SolidColorBrush x:Key="borderBrush" Color="Aqua" />
  103. <Style x:Key="ComboBoxStyle1" TargetType="{x:Type ComboBox}">
  104. <Setter Property="FocusVisualStyle" Value="{StaticResource ComboBoxFocusVisual}" />
  105. <Setter Property="Foreground" Value="{DynamicResource foreground}" />
  106. <Setter Property="Background" Value="Transparent" />
  107. <Setter Property="BorderBrush" Value="{DynamicResource borderBrush}" />
  108. <Setter Property="BorderThickness" Value="1" />
  109. <Setter Property="Margin" Value="0,0,0,0" />
  110. <Setter Property="Padding" Value="0" />
  111. <Setter Property="Height" Value="24" />
  112. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
  113. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
  114. <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
  115. <Setter Property="ScrollViewer.PanningMode" Value="Both" />
  116. <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
  117. <Setter Property="VerticalContentAlignment" Value="Center" />
  118. <Setter Property="IsTextSearchCaseSensitive" Value="true" />
  119. <Setter Property="IsEditable" Value="true" />
  120. <Setter Property="StaysOpenOnEdit" Value="true" />
  121. <Setter Property="Template">
  122. <Setter.Value>
  123. <ControlTemplate TargetType="{x:Type ComboBox}">
  124. <Border
  125. Background="{TemplateBinding Background}"
  126. BorderBrush="{TemplateBinding BorderBrush}"
  127. BorderThickness="{TemplateBinding BorderThickness}"
  128. SnapsToDevicePixels="true">
  129. <Grid>
  130. <Themes1:ClassicBorderDecorator
  131. x:Name="Border"
  132. BorderBrush="{x:Static Themes1:ClassicBorderDecorator.ClassicBorderBrush}"
  133. BorderStyle="None"
  134. BorderThickness="2">
  135. <Popup
  136. x:Name="PART_Popup"
  137. AllowsTransparency="true"
  138. Focusable="False"
  139. IsOpen="{TemplateBinding IsDropDownOpen}"
  140. Placement="Bottom"
  141. PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
  142. <Themes1:SystemDropShadowChrome
  143. x:Name="Shdw"
  144. MinWidth="{Binding ActualWidth, ElementName=Border}"
  145. MaxHeight="{TemplateBinding MaxDropDownHeight}"
  146. Color="Transparent">
  147. <Border
  148. x:Name="DropDownBorder"
  149. BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}"
  150. BorderThickness="1">
  151. <Border.Background>
  152. <SolidColorBrush Color="#264c73" />
  153. </Border.Background>
  154. <ScrollViewer x:Name="DropDownScrollViewer">
  155. <Grid RenderOptions.ClearTypeHint="Enabled">
  156. <Canvas
  157. Width="0"
  158. Height="0"
  159. HorizontalAlignment="Left"
  160. VerticalAlignment="Top">
  161. <Rectangle
  162. x:Name="OpaqueRect"
  163. Width="{Binding ActualWidth, ElementName=DropDownBorder}"
  164. Height="{Binding ActualHeight, ElementName=DropDownBorder}"
  165. Fill="{Binding Background, ElementName=DropDownBorder}" />
  166. </Canvas>
  167. <ItemsPresenter
  168. x:Name="ItemsPresenter"
  169. KeyboardNavigation.DirectionalNavigation="Contained"
  170. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  171. </Grid>
  172. </ScrollViewer>
  173. </Border>
  174. </Themes1:SystemDropShadowChrome>
  175. </Popup>
  176. </Themes1:ClassicBorderDecorator>
  177. <DockPanel Margin="2">
  178. <FrameworkElement Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" DockPanel.Dock="Right" />
  179. <Border x:Name="SelectedItemBorder" Margin="{TemplateBinding Padding}">
  180. <ContentPresenter
  181. Margin="1,1,1,1"
  182. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  183. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  184. Content="{TemplateBinding SelectionBoxItem}"
  185. ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
  186. ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
  187. ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
  188. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  189. </Border>
  190. </DockPanel>
  191. <ToggleButton
  192. Width="Auto"
  193. MinWidth="0"
  194. MinHeight="0"
  195. Margin="2"
  196. ClickMode="Press"
  197. Focusable="false"
  198. IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
  199. Style="{StaticResource ComboBoxTransparentButtonStyle}" />
  200. </Grid>
  201. </Border>
  202. <ControlTemplate.Triggers>
  203. <MultiTrigger>
  204. <MultiTrigger.Conditions>
  205. <Condition Property="IsDropDownOpen" Value="false" />
  206. </MultiTrigger.Conditions>
  207. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
  208. </MultiTrigger>
  209. <Trigger Property="HasItems" Value="false">
  210. <Setter TargetName="DropDownBorder" Property="MinHeight" Value="95" />
  211. </Trigger>
  212. <Trigger Property="IsEnabled" Value="false">
  213. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  214. <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
  215. </Trigger>
  216. <MultiTrigger>
  217. <MultiTrigger.Conditions>
  218. <Condition Property="IsGrouping" Value="true" />
  219. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
  220. </MultiTrigger.Conditions>
  221. <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
  222. </MultiTrigger>
  223. <Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="true">
  224. <Setter TargetName="Shdw" Property="Margin" Value="0,0,5,5" />
  225. <Setter TargetName="Shdw" Property="Color" Value="#71000000" />
  226. </Trigger>
  227. <Trigger SourceName="DropDownScrollViewer" Property="ScrollViewer.CanContentScroll" Value="false">
  228. <Setter TargetName="OpaqueRect" Property="Canvas.Top" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}" />
  229. <Setter TargetName="OpaqueRect" Property="Canvas.Left" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}" />
  230. </Trigger>
  231. </ControlTemplate.Triggers>
  232. </ControlTemplate>
  233. </Setter.Value>
  234. </Setter>
  235. <Style.Triggers>
  236. <Trigger Property="IsEditable" Value="true">
  237. <Setter Property="IsTabStop" Value="false" />
  238. <Setter Property="Padding" Value="1" />
  239. <Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}" />
  240. </Trigger>
  241. </Style.Triggers>
  242. </Style>
  243. </ResourceDictionary>
  244. </Window.Resources>
  245. <Border Name="br">
  246. <Border.Background>
  247. <!--<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png"></ImageBrush>-->
  248. <SolidColorBrush Color="#264c73" />
  249. </Border.Background>
  250. <Grid>
  251. <Grid.RowDefinitions>
  252. <RowDefinition Height="50" />
  253. <RowDefinition Height="80" />
  254. <RowDefinition Height="40" />
  255. <RowDefinition />
  256. </Grid.RowDefinitions>
  257. <TextBlock
  258. Margin="0,10"
  259. HorizontalAlignment="Center"
  260. VerticalAlignment="Center"
  261. FontSize="25"
  262. Foreground="#FF2AB2E7"
  263. Text="配方信息" />
  264. <UniformGrid Grid.Row="1" Columns="2">
  265. <StackPanel Orientation="Vertical">
  266. <StackPanel Margin="0,8" Orientation="Horizontal">
  267. <TextBlock
  268. Margin="10,0,5,0"
  269. VerticalAlignment="Center"
  270. FontSize="18"
  271. Foreground="#FF2AB2E7"
  272. Text="请输入配方名称:" />
  273. <TextBox
  274. Width="230"
  275. Height="30"
  276. VerticalAlignment="Center"
  277. VerticalContentAlignment="Center"
  278. Background="Transparent"
  279. BorderBrush="#FF2AB2E7"
  280. BorderThickness="1"
  281. FontSize="16"
  282. Foreground="Orange"
  283. Style="{DynamicResource TextBoxStyle}"
  284. Text="{Binding RecipeName}" />
  285. </StackPanel>
  286. <StackPanel Orientation="Horizontal">
  287. <TextBlock
  288. Margin="10,0,5,0"
  289. VerticalAlignment="Center"
  290. FontSize="18"
  291. Foreground="#FF2AB2E7"
  292. Text="请输入桶的数量:" />
  293. <TextBox
  294. Width="230"
  295. Height="30"
  296. VerticalAlignment="Center"
  297. VerticalContentAlignment="Center"
  298. Background="Transparent"
  299. BorderBrush="#FF2AB2E7"
  300. BorderThickness="1"
  301. FontSize="16"
  302. Foreground="Orange"
  303. InputMethod.IsInputMethodEnabled="False"
  304. Style="{DynamicResource TextBoxStyle}"
  305. Text="{Binding RecipeRollerNum}"
  306. TextChanged="TextBox_TextChanged" />
  307. </StackPanel>
  308. </StackPanel>
  309. <Grid>
  310. <Grid.RowDefinitions>
  311. <RowDefinition />
  312. <RowDefinition />
  313. </Grid.RowDefinitions>
  314. <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
  315. <Button
  316. Width="180"
  317. Height="30"
  318. Margin="0,0,10,0"
  319. Background="Transparent"
  320. BorderBrush="#FF2AB2E7"
  321. Command="{Binding AddRecipe}"
  322. Content="添加原料"
  323. Cursor="Hand"
  324. Foreground="#FF2AB2E7" />
  325. <Button
  326. Width="180"
  327. Height="30"
  328. Background="Transparent"
  329. BorderBrush="#FF2AB2E7"
  330. Command="{Binding Comfirm}"
  331. Content="确认更新"
  332. Foreground="#FF2AB2E7" />
  333. </StackPanel>
  334. <StackPanel
  335. Grid.Row="1"
  336. HorizontalAlignment="Center"
  337. Orientation="Horizontal">
  338. <Button
  339. Width="180"
  340. Height="30"
  341. Margin="0,0,10,0"
  342. Command="{Binding SaveAs}"
  343. Content="另存为"
  344. Cursor="Hand" />
  345. <Button
  346. Width="180"
  347. Height="30"
  348. Background="Transparent"
  349. BorderBrush="#FF2AB2E7"
  350. Click="Button_Click"
  351. Content="取消"
  352. Cursor="Hand"
  353. FontSize="20"
  354. Foreground="#FF2AB2E7" />
  355. </StackPanel>
  356. </Grid>
  357. </UniformGrid>
  358. <Grid
  359. Grid.Row="2"
  360. Margin="0,0,0,10"
  361. Background="#FF2AB2E7">
  362. <Grid.ColumnDefinitions>
  363. <ColumnDefinition Width="170"/>
  364. <ColumnDefinition Width="170"/>
  365. <ColumnDefinition Width="170"/>
  366. <ColumnDefinition Width="170"/>
  367. <ColumnDefinition/>
  368. </Grid.ColumnDefinitions>
  369. <TextBlock Text="原料名称" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/>
  370. <GridSplitter></GridSplitter>
  371. <TextBlock Grid.Column="1" Text="原料桶号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/>
  372. <GridSplitter Grid.Column="1"></GridSplitter>
  373. <TextBlock Grid.Column="2" Text="原料重量" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"></TextBlock>
  374. <GridSplitter Grid.Column="2"></GridSplitter>
  375. <TextBlock Grid.Column="3" Text="原料偏差" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"></TextBlock>
  376. <GridSplitter Grid.Column="3"></GridSplitter>
  377. <TextBlock Grid.Column="4" Text="操作" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/>
  378. </Grid>
  379. <ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Hidden">
  380. <ItemsControl ItemsSource="{Binding materials}">
  381. <ItemsControl.ItemsPanel>
  382. <ItemsPanelTemplate>
  383. <StackPanel />
  384. </ItemsPanelTemplate>
  385. </ItemsControl.ItemsPanel>
  386. <ItemsControl.ItemTemplate>
  387. <DataTemplate>
  388. <RadioButton>
  389. <RadioButton.Template>
  390. <ControlTemplate>
  391. <Grid>
  392. <Grid.ColumnDefinitions>
  393. <ColumnDefinition Width="170"/>
  394. <ColumnDefinition Width="170"></ColumnDefinition>
  395. <ColumnDefinition Width="170"></ColumnDefinition>
  396. <ColumnDefinition Width="170"></ColumnDefinition>
  397. <ColumnDefinition></ColumnDefinition>
  398. </Grid.ColumnDefinitions>
  399. <ComboBox ItemsSource="{Binding DataContext.materialNames,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Text="{Binding MaterialName}" Margin="10,0,0,10" Width="160" FontSize="14" KeyUp="ComboBox_KeyUp" LostFocus="ComboBox_LostFocus" Style="{StaticResource ComboBoxStyle1}" Height="30">
  400. <ComboBox.ItemContainerStyle>
  401. <Style TargetType="{x:Type ComboBoxItem}">
  402. <Setter Property="Background" Value="White" />
  403. <Setter Property="Foreground" Value="#e69519" />
  404. </Style>
  405. </ComboBox.ItemContainerStyle>
  406. </ComboBox>
  407. <StackPanel Grid.Column="1" Orientation="Horizontal" >
  408. <TextBox Text="{Binding MaterialLoc}" Background="Transparent" FontSize="14" Height="30"
  409. BorderBrush="#e69519" Foreground="LightGray" Width="160" Margin="5,0,0,10" ></TextBox>
  410. </StackPanel>
  411. <StackPanel Orientation="Horizontal" Grid.Column="2">
  412. <TextBox Text="{Binding MaterialWeight}" Background="Transparent" FontSize="14" Height="30" LostFocus="TextBox_LostFocus_1" TextChanged="TextBox_TextChanged_1"
  413. BorderBrush="#e69519" Foreground="LightGray" Width="140" Margin="5,0,0,10" ></TextBox>
  414. <TextBlock VerticalAlignment="Center" FontSize="14" Margin="4,0,0,10" Text="Kg" Foreground="#e69519" ></TextBlock>
  415. </StackPanel>
  416. <StackPanel Orientation="Horizontal" Grid.Column="3">
  417. <TextBox Text="{Binding MaterialOffset}" Background="Transparent" FontSize="14" Height="30" LostFocus="TextBox_LostFocus" TextChanged="TextBox_TextChanged_2"
  418. BorderBrush="#e69519" Foreground="LightGray" Width="140" Margin="5,0,0,10" ></TextBox>
  419. <TextBlock VerticalAlignment="Center" FontSize="14" Margin="4,0,0,10" Text="Kg" Foreground="#e69519" ></TextBlock>
  420. </StackPanel>
  421. <StackPanel Orientation="Horizontal" Grid.Column="4">
  422. <CheckBox IsChecked="{Binding IsCommonMaterial}" VerticalAlignment="Center" Margin="20,0,0,10"/>
  423. <Button
  424. Content="删除"
  425. Width="70"
  426. Height="30"
  427. FontSize="14"
  428. Margin="10,0,20,10"
  429. Background="Transparent"
  430. BorderBrush="#e69519" Foreground="LightGray" HorizontalAlignment="Center"
  431. Command="{Binding DataContext.RemoveRecipe,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"
  432. CommandParameter="{Binding MaterialCode}"></Button>
  433. </StackPanel>
  434. <!--<Button Grid.Column="4"
  435. Content="删除"
  436. Width="100"
  437. Height="30"
  438. FontSize="14"
  439. Margin="5,0,20,10"
  440. Background="Transparent"
  441. BorderBrush="#e69519" Foreground="LightGray" HorizontalAlignment="Center"
  442. Command="{Binding DataContext.RemoveRecipe,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"
  443. CommandParameter="{Binding MaterialCode}"></Button>-->
  444. </Grid>
  445. </ControlTemplate>
  446. </RadioButton.Template>
  447. </RadioButton>
  448. </DataTemplate>
  449. </ItemsControl.ItemTemplate>
  450. </ItemsControl>
  451. </ScrollViewer>
  452. </Grid>
  453. </Border>
  454. </Window>