终端一体化运控平台
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.
 
 
 

164 lines
9.1 KiB

  1. <UserControl x:Class="BPASmart.RecipeManagement.View.RecipeManager"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:BPASmart.RecipeManagement.View"
  7. xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel"
  8. mc:Ignorable="d"
  9. d:DesignHeight="450" d:DesignWidth="800" Foreground="#FF2AB2E7">
  10. <UserControl.DataContext>
  11. <vm:RecipeManagerViewModel/>
  12. </UserControl.DataContext>
  13. <UserControl.Resources>
  14. <Style TargetType="ListViewItem" >
  15. <Setter Property="Margin" Value="10"/>
  16. <Setter Property="Template">
  17. <Setter.Value>
  18. <ControlTemplate TargetType="ListViewItem">
  19. <Border x:Name="mborder" BorderBrush="#009AC0" BorderThickness="1,5" CornerRadius="10" Margin="10"
  20. Background="#104E8B">
  21. <Grid
  22. Name="tt"
  23. Height="200"
  24. Width="150"
  25. Margin="5">
  26. <Grid.RowDefinitions>
  27. <RowDefinition Height="30" />
  28. <RowDefinition Height="20" />
  29. <RowDefinition Height="128" />
  30. <RowDefinition Height="2" />
  31. <RowDefinition Height="40" />
  32. </Grid.RowDefinitions>
  33. <TextBlock
  34. Grid.Row="0"
  35. Margin="2,5,0,0"
  36. HorizontalAlignment="Center"
  37. VerticalAlignment="Top"
  38. FontSize="18"
  39. Foreground="Orange"
  40. Text="{Binding Name}" />
  41. <TextBlock
  42. Grid.Row="1"
  43. Margin="5,0,0,0"
  44. VerticalAlignment="Top"
  45. Foreground="White"
  46. Text="配方信息:" />
  47. <ScrollViewer
  48. Grid.Row="2"
  49. VerticalAlignment="Top"
  50. Background="Transparent"
  51. HorizontalScrollBarVisibility="Hidden"
  52. VerticalScrollBarVisibility="Hidden">
  53. <Grid>
  54. <Grid.ColumnDefinitions>
  55. <ColumnDefinition Width="auto" />
  56. <ColumnDefinition />
  57. </Grid.ColumnDefinitions>
  58. <ItemsControl ItemsSource="{Binding recipeMaterials}">
  59. <ItemsControl.ItemTemplate>
  60. <DataTemplate>
  61. <Grid>
  62. <TextBlock
  63. Grid.Row="1"
  64. Margin="5,0,0,0"
  65. HorizontalAlignment="Right"
  66. VerticalAlignment="Center"
  67. Foreground="#FF2AB2E7"
  68. Text="{Binding Name}" />
  69. </Grid>
  70. </DataTemplate>
  71. </ItemsControl.ItemTemplate>
  72. </ItemsControl>
  73. <ItemsControl Grid.Column="1"
  74. VerticalAlignment="Center"
  75. VerticalContentAlignment="Center" ItemsSource="{Binding recipeMaterials}">
  76. <ItemsControl.ItemTemplate>
  77. <DataTemplate>
  78. <StackPanel Orientation="Horizontal">
  79. <TextBlock
  80. Margin="5,0,0,0"
  81. HorizontalAlignment="Center"
  82. VerticalAlignment="Center"
  83. Foreground="#FF2AB2E7"
  84. Text=":" />
  85. <TextBlock
  86. Margin="5,0,0,0"
  87. HorizontalAlignment="Center"
  88. VerticalAlignment="Center"
  89. Foreground="#FF2AB2E7"
  90. Text="{Binding MaterialWeight}" />
  91. <TextBlock
  92. Margin="5,0,0,0"
  93. HorizontalAlignment="Center"
  94. VerticalAlignment="Center"
  95. Foreground="#FF2AB2E7"
  96. Text="g" />
  97. </StackPanel>
  98. </DataTemplate>
  99. </ItemsControl.ItemTemplate>
  100. </ItemsControl>
  101. </Grid>
  102. </ScrollViewer>
  103. <Button Grid.Row="4" Content="配方工艺" Style="{DynamicResource ButtonStyle}"
  104. Height="20" Width="80" HorizontalAlignment="Right" VerticalAlignment="Top"
  105. Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor},Path=DataContext.PecipeSettingCommand}"
  106. CommandParameter="{Binding ID}"/>
  107. </Grid>
  108. </Border>
  109. <ControlTemplate.Triggers>
  110. <Trigger Property="IsMouseOver" Value="True">
  111. <Setter Property="BorderBrush" Value="#CD8500" TargetName="mborder"/>
  112. </Trigger>
  113. <Trigger Property="IsFocused" Value="True">
  114. </Trigger>
  115. </ControlTemplate.Triggers>
  116. </ControlTemplate>
  117. </Setter.Value>
  118. </Setter>
  119. </Style>
  120. </UserControl.Resources>
  121. <Grid>
  122. <Grid.RowDefinitions>
  123. <RowDefinition Height="40"/>
  124. <RowDefinition/>
  125. </Grid.RowDefinitions>
  126. <TextBlock Text="配方清单" FontSize="28" VerticalAlignment="Center" HorizontalAlignment="Center"/>
  127. <ListView Grid.Row="1"
  128. ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding RecipeList}" Margin=" 10" Background="Transparent" >
  129. <ListView.ContextMenu>
  130. <ContextMenu FontSize="16" Foreground="White">
  131. <MenuItem Header="新建配方" Name="MenuAdd" Command="{Binding CreateRecipeCommand}"></MenuItem>
  132. <MenuItem Header="编辑配方" Name="MenuEdit"
  133. Command="{Binding EditRecipeCommand }"
  134. CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"></MenuItem>
  135. <MenuItem Header="删除配方" Name="MenuDelete"
  136. Command="{Binding DeleteRecipeCommand}"
  137. CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"></MenuItem>
  138. </ContextMenu>
  139. </ListView.ContextMenu>
  140. <ListBox.ItemsPanel>
  141. <ItemsPanelTemplate>
  142. <WrapPanel Margin="10"/>
  143. </ItemsPanelTemplate>
  144. </ListBox.ItemsPanel>
  145. </ListView>
  146. </Grid>
  147. </UserControl>