终端一体化运控平台
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

199 líneas
12 KiB

  1. <UserControl x:Class="BPASmart.RecipeManagement.View.MaterialManager"
  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" >
  10. <UserControl.DataContext>
  11. <vm:MaterialManagerViewModel/>
  12. </UserControl.DataContext>
  13. <UserControl.Resources>
  14. <Style TargetType="ListViewItem" >
  15. <Setter Property="Margin" Value="60,20"/>
  16. <Setter Property="Template">
  17. <Setter.Value>
  18. <ControlTemplate TargetType="ListViewItem">
  19. <Border x:Name="mborder" BorderBrush="#009AC0" BorderThickness="1,5" CornerRadius="10">
  20. <Grid Width="100" >
  21. <Grid.Background>
  22. <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
  23. <GradientStop Color="#4F94CD" Offset="0"/>
  24. <GradientStop Color="Transparent" Offset="0.3"/>
  25. <GradientStop Color="Transparent" Offset="0.7"/>
  26. <GradientStop Color="#4F94CD" Offset="1" />
  27. </LinearGradientBrush>
  28. </Grid.Background>
  29. <Grid.RowDefinitions>
  30. <RowDefinition Height="60"/>
  31. <RowDefinition Height="25"/>
  32. </Grid.RowDefinitions>
  33. <Grid.ColumnDefinitions>
  34. <ColumnDefinition Width="*"/>
  35. <ColumnDefinition Width="*"/>
  36. </Grid.ColumnDefinitions>
  37. <TextBlock Text="{Binding MaterialPosion}" Height="20" Width="20" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,0"/>
  38. <TextBlock Text="{Binding Name}" Grid.ColumnSpan="2"
  39. FontSize="24"
  40. HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
  41. <TextBlock Grid.Row="1" Text="种类:" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Right"/>
  42. <TextBlock Grid.Row="1" Grid.Column="1" FontSize="16"
  43. VerticalAlignment="Center" HorizontalAlignment="Left"
  44. Text="{Binding MaterialType}" TextAlignment="Center"></TextBlock>
  45. </Grid>
  46. </Border>
  47. <ControlTemplate.Triggers>
  48. <Trigger Property="IsMouseOver" Value="True">
  49. <Setter Property="BorderBrush" Value="#D2B48C" TargetName="mborder"/>
  50. </Trigger>
  51. <Trigger Property="IsFocused" Value="True">
  52. </Trigger>
  53. </ControlTemplate.Triggers>
  54. </ControlTemplate>
  55. </Setter.Value>
  56. </Setter>
  57. </Style>
  58. <Style TargetType="{x:Type ContextMenu}">
  59. <Setter Property="Template">
  60. <Setter.Value>
  61. <ControlTemplate TargetType="{x:Type ContextMenu}">
  62. <Border x:Name="Border" CornerRadius="4" Background="#009ACD" BorderThickness="1" Margin="0">
  63. <Border.BorderBrush>
  64. <SolidColorBrush Color="#104E8B" />
  65. </Border.BorderBrush>
  66. <ItemsPresenter/>
  67. </Border>
  68. <ControlTemplate.Triggers>
  69. <MultiTrigger>
  70. <MultiTrigger.Conditions>
  71. <Condition Property="IsMouseOver" Value="True"/>
  72. </MultiTrigger.Conditions>
  73. <MultiTrigger.EnterActions>
  74. <BeginStoryboard>
  75. <Storyboard>
  76. <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Width)">
  77. <SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/>
  78. <SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="110"/>
  79. </DoubleAnimationUsingKeyFrames>
  80. <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Height)">
  81. <SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/>
  82. <SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="100"/>
  83. </DoubleAnimationUsingKeyFrames>
  84. </Storyboard>
  85. </BeginStoryboard>
  86. </MultiTrigger.EnterActions>
  87. </MultiTrigger>
  88. </ControlTemplate.Triggers>
  89. </ControlTemplate>
  90. </Setter.Value>
  91. </Setter>
  92. </Style>
  93. <Style TargetType="{x:Type MenuItem}">
  94. <Setter Property="Template">
  95. <Setter.Value>
  96. <ControlTemplate TargetType="{x:Type MenuItem}">
  97. <Border Margin="0,5" MinWidth="80" CornerRadius="5">
  98. <Border.Background>
  99. <SolidColorBrush x:Name="MyAnimatedBrushBackground" Color="Transparent" />
  100. </Border.Background>
  101. <StackPanel Orientation="Horizontal">
  102. <TextBlock Text=" "/>
  103. <ContentPresenter ContentSource="Icon" HorizontalAlignment="Center" VerticalAlignment="Center" />
  104. <TextBlock Text=" "/>
  105. <ContentPresenter ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center"/>
  106. </StackPanel>
  107. </Border>
  108. <ControlTemplate.Triggers>
  109. <MultiTrigger>
  110. <MultiTrigger.Conditions>
  111. <Condition Property="IsMouseOver" Value="True"/>
  112. </MultiTrigger.Conditions>
  113. <MultiTrigger.EnterActions>
  114. <BeginStoryboard>
  115. <Storyboard>
  116. <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color">
  117. <LinearColorKeyFrame Value="Transparent" KeyTime="00:00:00.0020000" />
  118. <LinearColorKeyFrame Value="#B0E2FF" KeyTime="00:00:00.0320000" />
  119. </ColorAnimationUsingKeyFrames>
  120. </Storyboard>
  121. </BeginStoryboard>
  122. </MultiTrigger.EnterActions>
  123. <MultiTrigger.ExitActions>
  124. <BeginStoryboard>
  125. <Storyboard>
  126. <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color">
  127. <LinearColorKeyFrame Value="#7E9C9C9C" KeyTime="00:00:00.0020000" />
  128. <LinearColorKeyFrame Value="Transparent" KeyTime="00:00:00.0320000" />
  129. </ColorAnimationUsingKeyFrames>
  130. </Storyboard>
  131. </BeginStoryboard>
  132. </MultiTrigger.ExitActions>
  133. </MultiTrigger>
  134. </ControlTemplate.Triggers>
  135. </ControlTemplate>
  136. </Setter.Value>
  137. </Setter>
  138. </Style>
  139. </UserControl.Resources>
  140. <Grid Background="White">
  141. <Grid.ColumnDefinitions>
  142. <ColumnDefinition />
  143. </Grid.ColumnDefinitions>
  144. <Grid.RowDefinitions>
  145. <RowDefinition Height="*"/>
  146. <RowDefinition Height="*"/>
  147. </Grid.RowDefinitions>
  148. <Grid Grid.RowSpan="2">
  149. <Grid.RowDefinitions>
  150. <RowDefinition Height="40"/>
  151. <RowDefinition Height="*"/>
  152. </Grid.RowDefinitions>
  153. <TextBlock Text="原料清单" FontSize="28" Foreground="DarkSlateGray" VerticalAlignment="Center" HorizontalAlignment="Center"/>
  154. <ListView x:Name="mylistview" Grid.Row="1"
  155. ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding MaterialList}" Margin=" 10" Background="#FFFAFA" >
  156. <ListView.ContextMenu>
  157. <ContextMenu FontSize="16" Foreground="White">
  158. <MenuItem Header="新建原料" Name="MenuAdd" Command="{Binding CreateMaterailCommand}"></MenuItem>
  159. <MenuItem Header="编辑原料" Name="MenuEdit"
  160. Command="{Binding EditMaterailCommand }"
  161. CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"></MenuItem>
  162. <MenuItem Header="删除原料" Name="MenuDelete"
  163. Command="{Binding DeleteMaterailCommand}"
  164. CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"></MenuItem>
  165. </ContextMenu>
  166. </ListView.ContextMenu>
  167. <ListBox.ItemsPanel>
  168. <ItemsPanelTemplate>
  169. <WrapPanel Margin="10"/>
  170. </ItemsPanelTemplate>
  171. </ListBox.ItemsPanel>
  172. <!--<ContextMenu>
  173. <ContextMenu FontSize="16" Foreground="White">
  174. <MenuItem Header="新建原料" Name="MenuCreate"
  175. Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.CreateMaterailCommand}"></MenuItem>
  176. <MenuItem Header="编辑原料" Name="MenuEdit"
  177. Command="{Binding RelativeSource={RelativeSource Mode= FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.EditMaterailCommand}"
  178. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListView}},Path=SelectedItem}"></MenuItem>
  179. <MenuItem Header="删除原料" Name="MenuDelete"
  180. Command="{Binding RelativeSource={RelativeSource Mode= FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.DeleteMaterailCommand}"
  181. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListView}},Path=SelectedItem}"></MenuItem>
  182. </ContextMenu>
  183. </ContextMenu>-->
  184. </ListView>
  185. </Grid>
  186. </Grid>
  187. </UserControl>