终端一体化运控平台
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

295 satır
22 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="Aqua" 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="Aqua" 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="Aqua" VerticalAlignment="Center" FontSize="16" ></TextBox>
  203. </StackPanel>
  204. <StackPanel Orientation="Horizontal">
  205. <TextBlock Text="请输入桶的数量:" Foreground="Aqua" 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="Aqua" VerticalAlignment="Center" FontSize="16" TextChanged="TextBox_TextChanged"></TextBox>
  209. </StackPanel>
  210. </StackPanel>
  211. <StackPanel Orientation="Horizontal">
  212. <Button Content="添加原料" Width="150" Margin="10" Height="30" Background="Transparent" BorderBrush="Aqua" Foreground="Aqua" Cursor="Hand" Command="{Binding AddRecipe}" ></Button>
  213. <Button Content="确认" Height="30" Width="100" Margin="5,10" Background="Transparent" BorderBrush="Aqua" Foreground="Aqua" Command="{Binding Comfirm}"></Button>
  214. <Button Click="Button_Click" Content="取消" Height="30" FontSize="20" Background="Transparent" BorderBrush="Aqua" Foreground="Aqua" Width="100" Margin="8,10" Cursor="Hand"></Button>
  215. </StackPanel>
  216. </UniformGrid>
  217. <Grid Grid.Row="2" Background="Cyan" Margin="0,0,0,10">
  218. <Grid.ColumnDefinitions>
  219. <ColumnDefinition Width="210"/>
  220. <ColumnDefinition Width="225"/>
  221. <ColumnDefinition Width="225"/>
  222. <ColumnDefinition/>
  223. </Grid.ColumnDefinitions>
  224. <TextBlock Text="原料名称" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Tomato"/>
  225. <GridSplitter></GridSplitter>
  226. <TextBlock Grid.Column="1" Text="原料桶号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Tomato"/>
  227. <GridSplitter Grid.Column="1"></GridSplitter>
  228. <TextBlock Grid.Column="2" Text="原料重量" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Tomato"></TextBlock>
  229. <GridSplitter Grid.Column="2"></GridSplitter>
  230. <TextBlock Grid.Column="3" Text="操作" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Tomato"/>
  231. </Grid>
  232. <ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Hidden">
  233. <ItemsControl ItemsSource="{Binding materials}">
  234. <ItemsControl.ItemsPanel>
  235. <ItemsPanelTemplate>
  236. <StackPanel></StackPanel>
  237. </ItemsPanelTemplate>
  238. </ItemsControl.ItemsPanel>
  239. <ItemsControl.ItemTemplate>
  240. <DataTemplate>
  241. <RadioButton>
  242. <RadioButton.Template>
  243. <ControlTemplate>
  244. <Grid>
  245. <Grid.ColumnDefinitions>
  246. <ColumnDefinition Width="210"/>
  247. <ColumnDefinition Width="210"></ColumnDefinition>
  248. <ColumnDefinition Width="225"></ColumnDefinition>
  249. <ColumnDefinition></ColumnDefinition>
  250. </Grid.ColumnDefinitions>
  251. <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}">
  252. <ComboBox.ItemContainerStyle>
  253. <Style TargetType="{x:Type ComboBoxItem}">
  254. <Setter Property="Background" Value="White" />
  255. <Setter Property="Foreground" Value="#e69519"/>
  256. </Style>
  257. </ComboBox.ItemContainerStyle>
  258. </ComboBox>
  259. <StackPanel Grid.Column="1" Orientation="Horizontal" >
  260. <TextBox Text="{Binding MaterialLoc}" Background="Transparent" FontSize="14"
  261. BorderBrush="#e69519" Foreground="LightGray" Width="170" Margin="35,0,0,10" ></TextBox>
  262. </StackPanel>
  263. <StackPanel Orientation="Horizontal" Grid.Column="2">
  264. <TextBox Text="{Binding MaterialWeight}" Background="Transparent" FontSize="14"
  265. BorderBrush="#e69519" Foreground="LightGray" Width="170" Margin="35,0,0,10" ></TextBox>
  266. <TextBlock VerticalAlignment="Center" Margin="4,0,0,10" Text="g" Foreground="#e69519" ></TextBlock>
  267. </StackPanel>
  268. <Button Grid.Column="3"
  269. Content="删除"
  270. Width="94"
  271. FontSize="14"
  272. Margin="0,0,20,10"
  273. Background="Transparent"
  274. BorderBrush="#e69519" Foreground="LightGray" HorizontalAlignment="Right"
  275. Command="{Binding DataContext.RemoveRecipe,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"
  276. CommandParameter="{Binding MaterialCode}"></Button>
  277. </Grid>
  278. </ControlTemplate>
  279. </RadioButton.Template>
  280. </RadioButton>
  281. </DataTemplate>
  282. </ItemsControl.ItemTemplate>
  283. </ItemsControl>
  284. </ScrollViewer>
  285. </Grid>
  286. </Border>
  287. </Window>