终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

305 lines
23 KiB

  1. <Window x:Class="FryPot_DosingSystem.View.NewRecipeView"
  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:FryPot_DosingSystem.View"
  7. xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel" xmlns:Themes1="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic"
  8. mc:Ignorable="d"
  9. Title="NewRecipeView" Height="550" Width="800"
  10. WindowStyle="None" WindowStartupLocation="CenterScreen" AllowsTransparency="True">
  11. <Window.DataContext>
  12. <vm:NewRecipeViewModel></vm:NewRecipeViewModel>
  13. </Window.DataContext>
  14. <Window.Resources>
  15. <ResourceDictionary>
  16. <ResourceDictionary.MergedDictionaries>
  17. <ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
  18. <ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml"/>
  19. <ResourceDictionary>
  20. <!--#region ListBox样式-->
  21. <Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
  22. <Setter Property="OverridesDefaultStyle" Value="True" />
  23. <Setter Property="SnapsToDevicePixels" Value="True" />
  24. <Setter Property="BorderBrush" Value="{x:Null}" />
  25. <Setter Property="Foreground" Value="White" />
  26. <Setter Property="FontSize" Value="20" />
  27. <Setter Property="HorizontalContentAlignment" Value="Center" />
  28. <Setter Property="VerticalContentAlignment" Value="Center" />
  29. <Setter Property="Template">
  30. <Setter.Value>
  31. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  32. <Border x:Name="border" CornerRadius="8">
  33. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  34. </Border>
  35. </ControlTemplate>
  36. </Setter.Value>
  37. </Setter>
  38. </Style>
  39. <!--#endregion-->
  40. </ResourceDictionary>
  41. </ResourceDictionary.MergedDictionaries>
  42. <SolidColorBrush x:Key="TextBox.Static.Border" Color="#FFABAdB3"/>
  43. <SolidColorBrush x:Key="TextBox.MouseOver.Border" Color="#FF7EB4EA"/>
  44. <SolidColorBrush x:Key="TextBox.Focus.Border" Color="#FF569DE5"/>
  45. <Style x:Key="TextBoxStyle" TargetType="{x:Type TextBox}">
  46. <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
  47. <Setter Property="BorderBrush" Value="{StaticResource TextBox.Static.Border}"/>
  48. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
  49. <Setter Property="BorderThickness" Value="1"/>
  50. <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
  51. <Setter Property="HorizontalContentAlignment" Value="Left"/>
  52. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  53. <Setter Property="AllowDrop" Value="true"/>
  54. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
  55. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  56. <Setter Property="Template">
  57. <Setter.Value>
  58. <ControlTemplate TargetType="{x:Type TextBox}">
  59. <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
  60. <ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
  61. </Border>
  62. <ControlTemplate.Triggers>
  63. <Trigger Property="IsEnabled" Value="false">
  64. <Setter Property="Opacity" TargetName="border" Value="0.56"/>
  65. </Trigger>
  66. <Trigger Property="IsMouseOver" Value="true">
  67. <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource TextBox.MouseOver.Border}"/>
  68. </Trigger>
  69. <Trigger Property="IsKeyboardFocused" Value="true">
  70. <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource TextBox.Focus.Border}"/>
  71. </Trigger>
  72. </ControlTemplate.Triggers>
  73. </ControlTemplate>
  74. </Setter.Value>
  75. </Setter>
  76. <Style.Triggers>
  77. <MultiTrigger>
  78. <MultiTrigger.Conditions>
  79. <Condition Property="IsInactiveSelectionHighlightEnabled" Value="true"/>
  80. <Condition Property="IsSelectionActive" Value="false"/>
  81. </MultiTrigger.Conditions>
  82. <Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}"/>
  83. </MultiTrigger>
  84. </Style.Triggers>
  85. </Style>
  86. <SolidColorBrush x:Key="foreground" Color="#a2c2e8"/>
  87. <SolidColorBrush x:Key="borderBrush" Color="Aqua"/>
  88. <Style x:Key="ComboBoxStyle1" TargetType="{x:Type ComboBox}">
  89. <Setter Property="FocusVisualStyle" Value="{StaticResource ComboBoxFocusVisual}"/>
  90. <Setter Property="Foreground" Value="{DynamicResource foreground}"/>
  91. <Setter Property="Background" Value="Transparent"/>
  92. <Setter Property="BorderBrush" Value="{DynamicResource borderBrush}"/>
  93. <Setter Property="BorderThickness" Value="1"/>
  94. <Setter Property="Margin" Value="0,0,0,0"/>
  95. <Setter Property="Padding" Value="0"/>
  96. <Setter Property="Height" Value="24"/>
  97. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
  98. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
  99. <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
  100. <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
  101. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  102. <Setter Property="VerticalContentAlignment" Value="Center"/>
  103. <Setter Property="IsTextSearchCaseSensitive" Value="true"/>
  104. <Setter Property="IsEditable" Value="true"/>
  105. <Setter Property="StaysOpenOnEdit" Value="true"/>
  106. <Setter Property="Template">
  107. <Setter.Value>
  108. <ControlTemplate TargetType="{x:Type ComboBox}">
  109. <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
  110. <Grid>
  111. <Themes1:ClassicBorderDecorator x:Name="Border" BorderStyle="None" BorderBrush="{x:Static Themes1:ClassicBorderDecorator.ClassicBorderBrush}" BorderThickness="2">
  112. <Popup x:Name="PART_Popup" AllowsTransparency="true" Focusable="False" IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
  113. <Themes1:SystemDropShadowChrome x:Name="Shdw" Color="Transparent" MinWidth="{Binding ActualWidth, ElementName=Border}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
  114. <Border x:Name="DropDownBorder" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1">
  115. <Border.Background>
  116. <SolidColorBrush Color="#264c73"></SolidColorBrush>
  117. </Border.Background>
  118. <ScrollViewer x:Name="DropDownScrollViewer">
  119. <Grid RenderOptions.ClearTypeHint="Enabled">
  120. <Canvas HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
  121. <Rectangle x:Name="OpaqueRect" Fill="{Binding Background, ElementName=DropDownBorder}" Height="{Binding ActualHeight, ElementName=DropDownBorder}" Width="{Binding ActualWidth, ElementName=DropDownBorder}"/>
  122. </Canvas>
  123. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  124. </Grid>
  125. </ScrollViewer>
  126. </Border>
  127. </Themes1:SystemDropShadowChrome>
  128. </Popup>
  129. </Themes1:ClassicBorderDecorator>
  130. <DockPanel Margin="2">
  131. <FrameworkElement DockPanel.Dock="Right" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
  132. <Border x:Name="SelectedItemBorder" Margin="{TemplateBinding Padding}">
  133. <ContentPresenter ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" Content="{TemplateBinding SelectionBoxItem}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="1,1,1,1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  134. </Border>
  135. </DockPanel>
  136. <ToggleButton ClickMode="Press" Focusable="false" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="2" MinWidth="0" MinHeight="0" Style="{StaticResource ComboBoxTransparentButtonStyle}" Width="Auto"/>
  137. </Grid>
  138. </Border>
  139. <ControlTemplate.Triggers>
  140. <MultiTrigger>
  141. <MultiTrigger.Conditions>
  142. <Condition Property="IsDropDownOpen" Value="false"/>
  143. </MultiTrigger.Conditions>
  144. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
  145. </MultiTrigger>
  146. <Trigger Property="HasItems" Value="false">
  147. <Setter Property="MinHeight" TargetName="DropDownBorder" Value="95"/>
  148. </Trigger>
  149. <Trigger Property="IsEnabled" Value="false">
  150. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  151. <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
  152. </Trigger>
  153. <MultiTrigger>
  154. <MultiTrigger.Conditions>
  155. <Condition Property="IsGrouping" Value="true"/>
  156. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>
  157. </MultiTrigger.Conditions>
  158. <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
  159. </MultiTrigger>
  160. <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
  161. <Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
  162. <Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
  163. </Trigger>
  164. <Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
  165. <Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
  166. <Setter Property="Canvas.Left" TargetName="OpaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
  167. </Trigger>
  168. </ControlTemplate.Triggers>
  169. </ControlTemplate>
  170. </Setter.Value>
  171. </Setter>
  172. <Style.Triggers>
  173. <Trigger Property="IsEditable" Value="true">
  174. <Setter Property="IsTabStop" Value="false"/>
  175. <Setter Property="Padding" Value="1"/>
  176. <Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/>
  177. </Trigger>
  178. </Style.Triggers>
  179. </Style>
  180. </ResourceDictionary>
  181. </Window.Resources>
  182. <Border Name="br">
  183. <Border.Background>
  184. <!--<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png"></ImageBrush>-->
  185. <SolidColorBrush Color="#264c73">
  186. </SolidColorBrush>
  187. </Border.Background>
  188. <Grid >
  189. <Grid.RowDefinitions>
  190. <RowDefinition Height="50"></RowDefinition>
  191. <RowDefinition Height="80"></RowDefinition>
  192. <RowDefinition Height="40"></RowDefinition>
  193. <RowDefinition></RowDefinition>
  194. </Grid.RowDefinitions>
  195. <TextBlock Text="配方信息" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="0,10"></TextBlock>
  196. <UniformGrid Grid.Row="1" Columns="2">
  197. <StackPanel Orientation="Vertical">
  198. <StackPanel Orientation="Horizontal" Margin="0,8">
  199. <TextBlock Text="请输入配方名称:" Foreground="#FF2AB2E7" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
  200. <TextBox Style="{DynamicResource TextBoxStyle}" Text="{Binding RecipeName}" Width="230" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange"
  201. VerticalContentAlignment="Center"
  202. BorderBrush="#FF2AB2E7" VerticalAlignment="Center" FontSize="16" ></TextBox>
  203. </StackPanel>
  204. <StackPanel Orientation="Horizontal">
  205. <TextBlock Text="请输入桶的数量:" Foreground="#FF2AB2E7" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
  206. <TextBox Style="{DynamicResource TextBoxStyle}" Text="{Binding RecipeRollerNum}" InputMethod.IsInputMethodEnabled="False" Width="230" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange"
  207. VerticalContentAlignment="Center"
  208. BorderBrush="#FF2AB2E7" VerticalAlignment="Center" FontSize="16" TextChanged="TextBox_TextChanged"></TextBox>
  209. </StackPanel>
  210. </StackPanel>
  211. <Grid>
  212. <Grid.RowDefinitions>
  213. <RowDefinition/>
  214. <RowDefinition/>
  215. </Grid.RowDefinitions>
  216. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
  217. <Button Content="添加原料" Width="180" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" Command="{Binding AddRecipe}" ></Button>
  218. <Button Content="确认更新" Height="30" Width="180" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Command="{Binding Comfirm}"></Button>
  219. </StackPanel>
  220. <StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center">
  221. <Button Content="另存为" Height="30" Width="180" Margin="0,0,10,0" Command="{Binding SaveAs}" Cursor="Hand"/>
  222. <Button Click="Button_Click" Content="取消" Height="30" FontSize="20" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Width="180" Cursor="Hand"></Button>
  223. </StackPanel>
  224. </Grid>
  225. </UniformGrid>
  226. <Grid Grid.Row="2" Background="#FF2AB2E7" Margin="0,0,0,10">
  227. <Grid.ColumnDefinitions>
  228. <ColumnDefinition Width="210"/>
  229. <ColumnDefinition Width="225"/>
  230. <ColumnDefinition Width="225"/>
  231. <ColumnDefinition/>
  232. </Grid.ColumnDefinitions>
  233. <TextBlock Text="原料名称" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/>
  234. <GridSplitter></GridSplitter>
  235. <TextBlock Grid.Column="1" Text="原料桶号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/>
  236. <GridSplitter Grid.Column="1"></GridSplitter>
  237. <TextBlock Grid.Column="2" Text="原料重量" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"></TextBlock>
  238. <GridSplitter Grid.Column="2"></GridSplitter>
  239. <TextBlock Grid.Column="3" Text="操作" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/>
  240. </Grid>
  241. <ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Hidden">
  242. <ItemsControl ItemsSource="{Binding materials}">
  243. <ItemsControl.ItemsPanel>
  244. <ItemsPanelTemplate>
  245. <StackPanel></StackPanel>
  246. </ItemsPanelTemplate>
  247. </ItemsControl.ItemsPanel>
  248. <ItemsControl.ItemTemplate>
  249. <DataTemplate>
  250. <RadioButton>
  251. <RadioButton.Template>
  252. <ControlTemplate>
  253. <Grid>
  254. <Grid.ColumnDefinitions>
  255. <ColumnDefinition Width="210"/>
  256. <ColumnDefinition Width="210"></ColumnDefinition>
  257. <ColumnDefinition Width="225"></ColumnDefinition>
  258. <ColumnDefinition></ColumnDefinition>
  259. </Grid.ColumnDefinitions>
  260. <ComboBox ItemsSource="{Binding DataContext.materialNames,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Text="{Binding MaterialName}" Margin="10,0,0,10" Width="190" FontSize="14" KeyUp="ComboBox_KeyUp" LostFocus="ComboBox_LostFocus" Style="{StaticResource ComboBoxStyle1}">
  261. <ComboBox.ItemContainerStyle>
  262. <Style TargetType="{x:Type ComboBoxItem}">
  263. <Setter Property="Background" Value="White" />
  264. <Setter Property="Foreground" Value="#e69519"/>
  265. </Style>
  266. </ComboBox.ItemContainerStyle>
  267. </ComboBox>
  268. <StackPanel Grid.Column="1" Orientation="Horizontal" >
  269. <TextBox Text="{Binding MaterialLoc}" Background="Transparent" FontSize="14"
  270. BorderBrush="#e69519" Foreground="LightGray" Width="170" Margin="35,0,0,10" ></TextBox>
  271. </StackPanel>
  272. <StackPanel Orientation="Horizontal" Grid.Column="2">
  273. <TextBox Text="{Binding MaterialWeight}" Background="Transparent" FontSize="14"
  274. BorderBrush="#e69519" Foreground="LightGray" Width="170" Margin="35,0,0,10" ></TextBox>
  275. <TextBlock VerticalAlignment="Center" Margin="4,0,0,10" Text="g" Foreground="#e69519" ></TextBlock>
  276. </StackPanel>
  277. <Button Grid.Column="3"
  278. Content="删除"
  279. Width="94"
  280. FontSize="14"
  281. Margin="0,0,20,10"
  282. Background="Transparent"
  283. BorderBrush="#e69519" Foreground="LightGray" HorizontalAlignment="Right"
  284. Command="{Binding DataContext.RemoveRecipe,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"
  285. CommandParameter="{Binding MaterialCode}"></Button>
  286. </Grid>
  287. </ControlTemplate>
  288. </RadioButton.Template>
  289. </RadioButton>
  290. </DataTemplate>
  291. </ItemsControl.ItemTemplate>
  292. </ItemsControl>
  293. </ScrollViewer>
  294. </Grid>
  295. </Border>
  296. </Window>