|
- <Window x:Class="BPASmart.RecipeManagement.View.MaterialConfigure"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:local="clr-namespace:BPASmart.RecipeManagement.View"
- xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel"
- mc:Ignorable="d"
- Title="MaterialConfigure" Height="300" Width="500" WindowStartupLocation="CenterScreen" WindowStyle="None" Background="White" MouseLeftButtonDown="Window_MouseLeftButtonDown">
- <Window.DataContext>
- <vm:MaterialConfigureViewModel/>
- </Window.DataContext>
- <Window.Resources>
- <Style TargetType="{x:Type ComboBox}">
- <Setter Property="Background" Value="White"/>
- <Setter Property="ItemContainerStyle">
- <Setter.Value>
- <!--ComBoxItem-->
- <Style TargetType="ComboBoxItem">
- <Setter Property="MinHeight" Value="22"></Setter>
- <Setter Property="MinWidth" Value="60"></Setter>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="ComboBoxItem">
- <Border Name="Back" Background="Transparent" BorderThickness="0,0,0,0" BorderBrush="#81D779" >
- <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0,0,0"></ContentPresenter>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="Back" Property="Background" Value="LightGray"></Setter>
- </Trigger>
- <Trigger Property="IsHighlighted" Value="True">
- <Setter TargetName="Back" Property="Background" Value="LightGray"></Setter>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Setter.Value>
- </Setter>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ComboBox}">
- <Border BorderThickness="1" BorderBrush="#CDC9C9 " CornerRadius="3" Width="{TemplateBinding Width}" Height="40" Background="{TemplateBinding Background}" >
- <Grid >
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="3*"/>
- <ColumnDefinition Width="*"/>
- </Grid.ColumnDefinitions>
- <Grid Grid.Column="0" x:Name="grid">
- <ToggleButton
- Width="{Binding ElementName=grid,Path=ActualWidth}"
- Height="{Binding ElementName=grid, Path=ActualHeight}"
- Content="{TemplateBinding Text}" VerticalAlignment="Center"
- HorizontalAlignment="Left" Margin="5,0,0,0"
- BorderThickness="0"
- Foreground="{TemplateBinding Foreground}"
- Background="{TemplateBinding Background}"
- IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"
- >
- <ToggleButton.Style >
- <Style TargetType="ToggleButton">
- <Setter Property="Background" Value="White"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="ToggleButton">
- <Border Background="{TemplateBinding Background}" BorderThickness="0" >
- <TextBlock Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Content}" Margin="4 0 0 0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
- </Border>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- <Style.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter Property="Background" Value="White"/>
- </Trigger>
- <Trigger Property="IsMouseOver" Value="False">
- <Setter Property="Background" Value="White"/>
- </Trigger>
- </Style.Triggers>
- </Style>
- </ToggleButton.Style>
- </ToggleButton>
- </Grid>
-
- <Grid Grid.Column="1" >
- <ToggleButton IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
- Foreground="{TemplateBinding Foreground}"
- ClickMode="Press">
- <ToggleButton.Style>
- <Style TargetType="ToggleButton">
- <Setter Property="Background" Value="White"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="ToggleButton">
- <Border Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}">
- <Grid>
- <Image Source="pack://application:,,,/image/down,png" Stretch="Fill" HorizontalAlignment="Center" VerticalAlignment="Center">
- <Image.RenderTransform>
- <TransformGroup>
- <ScaleTransform/>
- <SkewTransform/>
- <RotateTransform/>
- <TranslateTransform/>
- </TransformGroup>
- </Image.RenderTransform>
- </Image>
- </Grid>
- </Border>
- <!--<ControlTemplate.Triggers>
- <Trigger Property="IsChecked" Value="True">
-
- </Trigger>
- <EventTrigger RoutedEvent="Checked">
- <BeginStoryboard>
- <Storyboard >
- <DoubleAnimationUsingKeyFrames Storyboard.TargetName="arrow_tb" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
- <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
- <EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="180"/>
- </DoubleAnimationUsingKeyFrames>
- </Storyboard>
- </BeginStoryboard>
- </EventTrigger>
-
- <EventTrigger RoutedEvent="Unchecked">
- <BeginStoryboard>
- <Storyboard >
- <DoubleAnimationUsingKeyFrames Storyboard.TargetName="arrow_tb" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
- <EasingDoubleKeyFrame KeyTime="00:00:00" Value="180"/>
- <EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/>
- </DoubleAnimationUsingKeyFrames>
- </Storyboard>
- </BeginStoryboard>
- </EventTrigger>
- </ControlTemplate.Triggers>-->
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </ToggleButton.Style>
- </ToggleButton>
- </Grid>
- <Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="True" PopupAnimation="Slide">
- <Border CornerRadius="1" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True">
- <Border.Effect>
- <DropShadowEffect Color="Black" BlurRadius="2" ShadowDepth="0" Opacity="0.5"/>
- </Border.Effect>
- <ScrollViewer Margin="4,6,4,6" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
- <!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
- <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" Background="White"/>
- </ScrollViewer>
- </Border>
- </Popup>
- </Grid>
-
-
- <Border.Effect>
- <DropShadowEffect ShadowDepth="-1" Opacity="0.3" Color="#FF969696" BlurRadius="5"/>
- </Border.Effect>
- </Border>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
-
-
- </Style>
- </Window.Resources>
- <Border CornerRadius="20" Background="#FFFAFA">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="17*"/>
- <ColumnDefinition Width="33*"/>
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition/>
- <RowDefinition />
- <RowDefinition />
- <RowDefinition Height="40"/>
- <RowDefinition />
- </Grid.RowDefinitions>
- <TextBlock Text="原料名称:" FontSize="22"
- HorizontalAlignment="Center" VerticalAlignment="Center" Height="28" Width="92"/>
- <TextBlock Text="原料种类:" FontSize="22" Grid.Row="1"
- HorizontalAlignment="Center" VerticalAlignment="Center" Height="28" Width="92"/>
- <TextBlock Text="原料位置:" FontSize="22" Grid.Row="2"
- HorizontalAlignment="Center" VerticalAlignment="Center" Height="28" Width="92"/>
- <TextBox Text="{Binding MaterialName}" FontSize="22" Grid.Column="1" Width="200" Height="40"
- VerticalAlignment="Center" HorizontalAlignment="Center"
- VerticalContentAlignment="Center"/>
- <ComboBox ItemsSource="{Binding MaterialTypes}"
- FontSize="18"
- Grid.Column="1" Grid.Row="1" Width="200" Height="40"
- SelectedItem="{Binding MaterialType}"/>
- <TextBox Text="{Binding MaterialPosion}" FontSize="22" Grid.Column="1" Grid.Row="2"
- Width="100" Height="40"
- VerticalAlignment="Center" HorizontalAlignment="Center"
- VerticalContentAlignment="Center"/>
- <TextBlock Text="{Binding ErrorMessage}" Grid.Row="3" Grid.ColumnSpan=" 2"
- Foreground="Red" VerticalAlignment="Center" HorizontalAlignment="Center"/>
- <StackPanel Grid.Row="4" Grid.ColumnSpan="2" Orientation="Horizontal"
- HorizontalAlignment="Center" VerticalAlignment="Center">
- <Button Content="保存" Foreground="White" FontSize="22" Width="120" Height="40" Margin="10" Background="#58B0ED"
- Command="{Binding SaveCommand}"/>
- <Button Content="取消" Foreground="White" FontSize="22" Width="120" Height="40" Margin="10" Background="#58B0ED"
- Click="Button_Click"/>
-
- </StackPanel>
-
- </Grid>
- </Border>
- </Window>
|