终端一体化运控平台
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

171 lines
11 KiB

  1. <UserControl x:Class="FryPot_DosingSystem.View.RecipeManageView"
  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:FryPot_DosingSystem.View"
  7. xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel"
  8. xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
  9. mc:Ignorable="d"
  10. d:DesignHeight="450" d:DesignWidth="800">
  11. <UserControl.DataContext>
  12. <vm:RecipeSetViewModel/>
  13. </UserControl.DataContext>
  14. <UserControl.Resources>
  15. <Style x:Key="GridResize" TargetType="Grid">
  16. <Style.Triggers>
  17. <!--<Trigger Property="IsMouseOver" Value="False"/>-->
  18. <EventTrigger RoutedEvent="MouseEnter" >
  19. <BeginStoryboard>
  20. <Storyboard>
  21. <DoubleAnimation Duration="0:0:0.2" To="236" Storyboard.TargetProperty="Width"/>
  22. <DoubleAnimation Duration="0:0:0.2" To="281" Storyboard.TargetProperty="Height"/>
  23. </Storyboard>
  24. </BeginStoryboard>
  25. </EventTrigger>
  26. <EventTrigger RoutedEvent="MouseLeave" >
  27. <BeginStoryboard>
  28. <Storyboard>
  29. <DoubleAnimation Duration="0:0:0.2" To="235" Storyboard.TargetProperty="Width"/>
  30. <DoubleAnimation Duration="0:0:0.2" To="280" Storyboard.TargetProperty="Height"/>
  31. </Storyboard>
  32. </BeginStoryboard>
  33. </EventTrigger>
  34. </Style.Triggers>
  35. </Style>
  36. <Style x:Key="FocusVisual">
  37. <Setter Property="Control.Template">
  38. <Setter.Value>
  39. <ControlTemplate>
  40. <Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
  41. </ControlTemplate>
  42. </Setter.Value>
  43. </Setter>
  44. </Style>
  45. <SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD"/>
  46. <SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070"/>
  47. <SolidColorBrush x:Key="Button.MouseOver.Background" Color="Transparent"/>
  48. <SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1"/>
  49. <SolidColorBrush x:Key="Button.Pressed.Background" Color="#FFC4E5F6"/>
  50. <SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/>
  51. <SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF4F4F4"/>
  52. <SolidColorBrush x:Key="Button.Disabled.Border" Color="#FFADB2B5"/>
  53. <SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#FF838383"/>
  54. <Style x:Key="ButtonStyle1" TargetType="{x:Type Button}">
  55. <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
  56. <Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
  57. <Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
  58. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
  59. <Setter Property="BorderThickness" Value="1"/>
  60. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  61. <Setter Property="VerticalContentAlignment" Value="Center"/>
  62. <Setter Property="Padding" Value="1"/>
  63. <Setter Property="Template">
  64. <Setter.Value>
  65. <ControlTemplate TargetType="{x:Type Button}">
  66. <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
  67. <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  68. </Border>
  69. <ControlTemplate.Triggers>
  70. <Trigger Property="IsDefaulted" Value="true">
  71. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
  72. </Trigger>
  73. <Trigger Property="IsMouseOver" Value="true">
  74. <Setter Property="Background" TargetName="border" Value="{StaticResource Button.MouseOver.Background}"/>
  75. <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border}"/>
  76. </Trigger>
  77. <Trigger Property="IsPressed" Value="true">
  78. <Setter Property="Background" TargetName="border" Value="{StaticResource Button.Pressed.Background}"/>
  79. <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
  80. </Trigger>
  81. <Trigger Property="IsEnabled" Value="false">
  82. <Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background}"/>
  83. <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
  84. <Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
  85. </Trigger>
  86. </ControlTemplate.Triggers>
  87. </ControlTemplate>
  88. </Setter.Value>
  89. </Setter>
  90. </Style>
  91. </UserControl.Resources>
  92. <Grid>
  93. <Grid.RowDefinitions>
  94. <RowDefinition Height="55"></RowDefinition>
  95. <!--<RowDefinition Height="30"></RowDefinition>-->
  96. <RowDefinition></RowDefinition>
  97. </Grid.RowDefinitions>
  98. <UniformGrid Columns="2">
  99. <Image Source="../hbl.ico" HorizontalAlignment="Left"></Image>
  100. <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Column="2">
  101. <pry:IcoButton Content="新建配方"
  102. Margin="80,15,10,0"
  103. Width="150"
  104. FontSize="16"
  105. Foreground="Aqua"
  106. IcoText="&#xe626;"
  107. Cursor="Hand"
  108. Style="{StaticResource IcoButtonStyle}"
  109. Command="{Binding NewRecipe}">
  110. </pry:IcoButton>
  111. <pry:IcoButton
  112. Content="保存配方" Margin="5,15,10,0"
  113. Width="150"
  114. FontSize="16"
  115. Foreground="Aqua"
  116. IcoText="&#xe626;"
  117. Cursor="Hand"
  118. Style="{StaticResource IcoButtonStyle}"
  119. Command="{Binding SaveRecipe}">
  120. </pry:IcoButton>
  121. </StackPanel>
  122. </UniformGrid>
  123. <ScrollViewer Grid.Row="2" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Hidden" Padding="0,5,0,0">
  124. <ItemsControl ItemsSource="{Binding recipeModels}">
  125. <ItemsControl.ItemsPanel>
  126. <ItemsPanelTemplate>
  127. <WrapPanel></WrapPanel>
  128. </ItemsPanelTemplate>
  129. </ItemsControl.ItemsPanel>
  130. <ItemsControl.ItemTemplate>
  131. <DataTemplate>
  132. <Grid Width="235" Height="280" Margin="6,6" Style="{StaticResource GridResize}">
  133. <Grid.RowDefinitions>
  134. <RowDefinition Height="150"/>
  135. <RowDefinition />
  136. </Grid.RowDefinitions>
  137. <Button Panel.ZIndex="1" VerticalAlignment="Top" Background="Transparent" HorizontalAlignment="Right" Width="15" Height="15" FontFamily="/BPASmartClient.CustomResource;component/Fonts/#iconfont" Content="&#xe639;" BorderThickness="0" Foreground="LightGray" Command="{Binding DataContext.DeleteRecipeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" CommandParameter="{Binding RecipeId}"></Button>
  138. <Image Stretch="Fill" Source="/BPASmartClient.CustomResource;component/Image/调味品.jpeg"/>
  139. <StackPanel Grid.Row="2">
  140. <StackPanel.Background>
  141. <ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/浅色背景.jpeg" Opacity="0.4"/>
  142. </StackPanel.Background>
  143. <StackPanel Orientation="Horizontal" Margin="0,5">
  144. <TextBlock Text="配方:" Foreground="White" FontSize="18"></TextBlock>
  145. <TextBlock Text="{Binding RecipeName}" Foreground="Orange" FontSize="18"></TextBlock>
  146. </StackPanel>
  147. <StackPanel Orientation="Horizontal" Margin="0,5">
  148. <TextBlock Text="操作:" Foreground="White" FontSize="18"></TextBlock>
  149. <Button Style="{DynamicResource ButtonStyle1}" Content="编辑" Cursor="Hand" Foreground="Orange" FontSize="18" Background="Transparent" BorderThickness="0" Command="{Binding DataContext.EditRecipeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"
  150. CommandParameter="{Binding RecipeId}"/>
  151. </StackPanel>
  152. <StackPanel Orientation="Horizontal" Margin="0,5">
  153. <TextBlock Text="创建时间:" FontSize="18" Foreground="White"></TextBlock>
  154. <TextBlock Text="{Binding DataTime}" FontSize="18" Foreground="Orange"/>
  155. </StackPanel>
  156. <StackPanel Orientation="Horizontal" Margin="0,5">
  157. <TextBlock Text="更新时间:" FontSize="18" Foreground="White"></TextBlock>
  158. <TextBlock Text="{Binding UpdateTime}" FontSize="18" Foreground="Orange"/>
  159. </StackPanel>
  160. </StackPanel>
  161. </Grid>
  162. </DataTemplate>
  163. </ItemsControl.ItemTemplate>
  164. </ItemsControl>
  165. </ScrollViewer>
  166. </Grid>
  167. </UserControl>