| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322 | <UserControl x:Class="Aitex.UI.RecipeEditor.RecipeEditorControl"             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"              mc:Ignorable="d"             xmlns:s="clr-namespace:System;assembly=mscorlib"             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"             xmlns:app="clr-namespace:Aitex.UI.RecipeEditor"             xmlns:xctl="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit"             xmlns:toolkit="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit"             xmlns:xctk="http://schemas.xceed.com/wpf/xaml/datagrid"             d:DesignHeight="452" d:DesignWidth="1201" FontFamily="Arial,SimSun" >    <Grid x:Name="grid1">        <Grid.RowDefinitions>            <RowDefinition Height="32" />            <RowDefinition Height="426*" />        </Grid.RowDefinitions>        <Grid.Resources>            <Style TargetType="TextBlock">                <Setter Property="FontWeight" Value="Normal"></Setter>            </Style>            <DataTemplate x:Key="defaultGroupTemplate">                <StackPanel Orientation="Horizontal" VerticalAlignment="Center">                    <ContentPresenter VerticalAlignment="Center" Content="{Binding Value}" ContentTemplate="{Binding Path=DataContext.ValueTemplate, RelativeSource={RelativeSource TemplatedParent}}" ContentTemplateSelector="{Binding Path=DataContext.ValueTemplateSelector, RelativeSource={RelativeSource TemplatedParent}}" />                </StackPanel>            </DataTemplate>                        <DataTemplate x:Key="{DataTemplateKey {x:Type xctk:Group}}" DataType="{x:Type xctk:Group}">                <ContentControl Name="groupContentPresenter" Focusable="False" ContentTemplate="{StaticResource defaultGroupTemplate}" Content="{Binding}" />            </DataTemplate>            <Style TargetType="{x:Type xctk:GroupHeaderControl}" BasedOn="{x:Null}">                <Setter Property="Template">                    <Setter.Value>                        <ControlTemplate TargetType="{x:Type xctk:GroupHeaderControl}">                            <Border  BorderThickness="2">                                <StackPanel Orientation="Horizontal">                                    <ContentPresenter/>                                </StackPanel>                            </Border>                        </ControlTemplate>                    </Setter.Value>                </Setter>            </Style>            <app:CellForeColorConverter x:Key="CellForeColorConverter" />            <app:ErrColorConverter x:Key="ErrColorConverter" />            <app:ErrContentConverter x:Key="ErrContentConverter" />            <app:ErrTooltipConverter x:Key="ErrTooltipConverter" />            <app:RecipeHeadStringConverter x:Key="RecipeHeadStringConverter" />            <app:CellBorderConverter x:Key="cellBorderConverter" />            <app:JumpCellBorderConverter x:Key="jumpCellBorderConverter"/>            <DataTemplate x:Key="columnRedTitleTemplate">                <TextBlock Text="{Binding}" Foreground="Black"/>            </DataTemplate>            <DataTemplate x:Key="columnBlackTitleTemplate">                <TextBlock Text="{Binding}" Foreground="Black"/>            </DataTemplate>            <DataTemplate x:Key="CustomTemplate">                <Border BorderThickness="{Binding IsRunning,Converter={StaticResource cellBorderConverter}}" BorderBrush="Blue">                    <TextBlock Text="{Binding Display}"  Foreground="Black" Background="{Binding Background}" ToolTip="{Binding ToolTip}"  FontWeight="Normal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>                </Border>            </DataTemplate>            <DataTemplate x:Key="RowHeadTemplate">                <TextBlock Text="{Binding Path=FriendlyName}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Foreground="Black"/>            </DataTemplate>            <xctk:DataGridCollectionViewSource x:Key="recipeData" Source="{Binding RecipeRows}">                <xctk:DataGridCollectionViewSource.GroupDescriptions>                    <PropertyGroupDescription PropertyName="CatalogName" />                </xctk:DataGridCollectionViewSource.GroupDescriptions>            </xctk:DataGridCollectionViewSource>        </Grid.Resources>        <Grid Grid.Row="0">            <StackPanel Orientation="Horizontal">                <toolkit:SplitButton Width="70" Focusable="False" BorderThickness="0" Command="{Binding OpenLocalRecipeCommand}" Visibility="{Binding SingleAppElementVisibility}">                    <toolkit:SplitButton.Content>                        <WrapPanel>                            <Image Height="16" Source="/RecipeEditorControl;component/Images/open.png" />                            <TextBlock Text=" Open" FontFamily="Arial,SimSun" />                        </WrapPanel>                    </toolkit:SplitButton.Content>                    <toolkit:SplitButton.DropDownContent>                        <ListBox ItemsSource="{Binding OpenRecipeList}">                            <ListBox.ItemTemplate>                                <DataTemplate>                                    <Button Content="{Binding Item1}" Tag="{Binding Item2}" Background="Transparent" BorderBrush="Transparent" Height="20" Focusable="False" FontSize="12" Width="150" HorizontalContentAlignment="Left" Click="OpenButtonPanelLoaded" />                                </DataTemplate>                            </ListBox.ItemTemplate>                        </ListBox>                    </toolkit:SplitButton.DropDownContent>                </toolkit:SplitButton>                <toolkit:DropDownButton Width="70" Focusable="False" BorderThickness="0" x:Name="newButton" Visibility="{Binding SingleAppElementVisibility}">                    <toolkit:DropDownButton.Content>                        <WrapPanel>                            <Image Height="14" Source="/RecipeEditorControl;component/Images/edit_add.png" />                            <TextBlock Text=" New" FontFamily="Arial,SimSun" />                        </WrapPanel>                    </toolkit:DropDownButton.Content>                    <toolkit:DropDownButton.DropDownContent>                        <ListBox ItemsSource="{Binding CreateRecipeList}">                            <ListBox.ItemTemplate>                                <DataTemplate>                                    <Button Content="{Binding Item1}" Tag="{Binding Item2}" Background="Transparent" BorderBrush="Transparent" Height="20" Focusable="False" FontSize="12" Width="150" HorizontalContentAlignment="Left" Click="NewButtonPanelLoaded" />                                </DataTemplate>                            </ListBox.ItemTemplate>                        </ListBox>                    </toolkit:DropDownButton.DropDownContent>                </toolkit:DropDownButton>                <Button Width="60" Focusable="False" BorderThickness="0" Command="{Binding SaveRecipeCommand}"  Visibility="{Binding SingleAppElementVisibility}">                    <Button.Content>                        <WrapPanel>                            <Image Height="16" Source="/RecipeEditorControl;component/Images/save.png" />                            <TextBlock Text=" Save" FontFamily="Arial,SimSun" />                        </WrapPanel>                    </Button.Content>                </Button>                <toolkit:SplitButton Width="80" Focusable="False" BorderThickness="0" IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=Grid}, Path=DataContext.IsUndoEnabled}"                                      Command="{Binding RelativeSource={RelativeSource AncestorType=Grid}, Path=DataContext.UndoCommand}">                    <toolkit:SplitButton.Content>                        <WrapPanel>                            <Image Height="16" Source="/RecipeEditorControl;component/Images/arrow_undo.png" />                            <TextBlock Text="{DynamicResource GlobalLableButtonUndo}" FontFamily="Arial,SimSun" />                        </WrapPanel>                    </toolkit:SplitButton.Content>                    <toolkit:SplitButton.DropDownContent>                        <ListBox ItemsSource="{Binding UndoList}">                            <ListBox.ItemTemplate>                                <DataTemplate>                                    <Button Content="{Binding Item1}" ToolTip="{Binding Item2}" Tag="{Binding Item3}"                                            Background="Transparent" BorderBrush="Transparent" Command="{Binding RelativeSource={RelativeSource AncestorType=Grid},Path=DataContext.UndoCommand}"                                             Height="20" Focusable="False" FontSize="10" CommandParameter="{Binding Item4}" />                                </DataTemplate>                            </ListBox.ItemTemplate>                        </ListBox>                    </toolkit:SplitButton.DropDownContent>                </toolkit:SplitButton>                <toolkit:SplitButton Width="80" Focusable="False" BorderThickness="0" IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=Grid}, Path=DataContext.IsRedoEnabled}"                                     Command="{Binding RedoCommand}">                    <toolkit:SplitButton.Content>                        <WrapPanel>                            <Image Height="16" Source="/RecipeEditorControl;component/Images/arrow_redo.png" />                            <TextBlock Text="{DynamicResource GlobalLableButtonRedo}" FontFamily="Arial,SimSun" />                        </WrapPanel>                    </toolkit:SplitButton.Content>                    <toolkit:SplitButton.DropDownContent>                        <ListBox ItemsSource="{Binding RedoList}">                            <ListBox.ItemTemplate>                                <DataTemplate>                                    <Button Content="{Binding Item1}" ToolTip="{Binding Item2}" Tag="{Binding Item3}"                                            Background="Transparent" BorderBrush="Transparent" Command="{Binding RelativeSource={RelativeSource AncestorType=Grid},Path=DataContext.RedoCommand}"                                             Height="20" Focusable="False" FontSize="10" CommandParameter="{Binding Item4}" />                                </DataTemplate>                            </ListBox.ItemTemplate>                        </ListBox>                    </toolkit:SplitButton.DropDownContent>                </toolkit:SplitButton>                                <Button Width="80" Focusable="False" BorderThickness="0" Command="{Binding ExpandGroupCommand}">                    <Button.Content>                        <WrapPanel>                            <Image Height="13" Source="/RecipeEditorControl;component/Images/expand.png" />                            <TextBlock Text="{DynamicResource GlobalLableButtonExpand}" FontFamily="Arial,SimSun" />                        </WrapPanel>                    </Button.Content>                </Button>                <Button Width="80" Focusable="False" BorderThickness="0" Command="{Binding CollapseGroupCommand}">                    <Button.Content>                        <WrapPanel>                            <Image Height="13" Source="/RecipeEditorControl;component/Images/toggle.png" />                            <TextBlock Text="{DynamicResource GlobalLableButtonToggle}" FontFamily="Arial,SimSun" />                        </WrapPanel>                    </Button.Content>                </Button>                <Button Width="100" Focusable="False" BorderThickness="0" Command="{Binding ToggleHideSameCommand}">                    <Button.Content>                        <WrapPanel>                            <Image Height="16" Source="/RecipeEditorControl;component/Images/hideSame.png" />                            <TextBlock Text="{DynamicResource GlobalLableButtonHideSame}" FontFamily="Arial,SimSun" />                        </WrapPanel>                    </Button.Content>                </Button>                <Button Width="80" Focusable="False" BorderThickness="0" Command="{Binding RecipeExport2ExcelCommand}"  Visibility="{Binding SingleAppElementVisibility}">                    <Button.Content>                         <WrapPanel>                            <Image Height="16" Source="/RecipeEditorControl;component/Images/excel.png" />                            <TextBlock Text="{DynamicResource GlobalLableButtonExport}" FontFamily="Arial,SimSun" />                        </WrapPanel>                    </Button.Content>                </Button>                <Button Width="100" Focusable="False" BorderThickness="0" Command="{Binding EditRecipeInfoCommand}"                        ToolTip="{Binding RecipeHead,Converter={StaticResource RecipeHeadStringConverter}}">                    <Button.Content>                        <WrapPanel>                            <Image Height="14" Source="/RecipeEditorControl;component/Images/property.png" />                            <TextBlock Text="{DynamicResource GlobalLableButtonSetting}" FontFamily="Arial,SimSun" />                        </WrapPanel>                    </Button.Content>                </Button>                <Button Width="80" Focusable="False" BorderThickness="0" Command="{Binding ShowDetailedErrInfoCommand}"                        Background="{Binding Path=Errors, Converter={StaticResource ErrColorConverter}}"                        ToolTip="{Binding Path=Errors, Converter={StaticResource ErrTooltipConverter}}">                    <Button.Content>                        <WrapPanel>                            <Image Height="14" Source="/RecipeEditorControl;component/Images/warning.png" />                            <TextBlock Text="{Binding Errors, Converter={StaticResource ErrContentConverter}}" TextAlignment="Right" FontFamily="Arial,SimSun"/>                        </WrapPanel>                    </Button.Content>                </Button>                <Button Width="80" Focusable="False" BorderThickness="0" Command="{Binding RecipeHelpDocCommand}" Visibility="{Binding SingleAppElementVisibility}">                    <Button.Content>                        <WrapPanel>                            <Image Height="16" Source="/RecipeEditorControl;component/Images/help.png" />                            <TextBlock Text=" Help" FontFamily="Arial,SimSun" />                        </WrapPanel>                    </Button.Content>                </Button>                <Grid Visibility="{Binding IsBarcodeVisibility}">                    <TextBox Foreground="White" FontSize="30" InputMethod.PreferredImeState="Off" InputMethod.IsInputMethodEnabled="False"  Text="{Binding RecipeHead.Barcode}"  PreviewTextInput="UIElement_OnPreviewTextInput"  TabIndex="0" BorderThickness="1" Margin="0" Width="230"  HorizontalAlignment="Center" TextAlignment="Center" VerticalContentAlignment="Center"  >                        <TextBox.Background>                            <ImageBrush  Stretch="Fill" x:Name="BarcodeBrushName" Opacity="0.1" AlignmentX="Center" AlignmentY="Center">                                <ImageBrush.ImageSource>                                    <BitmapImage UriSource="/RecipeEditorControl;component/Images/barcode.png"/>                                </ImageBrush.ImageSource>                            </ImageBrush>                        </TextBox.Background>                        <TextBox.Triggers>                            <!-- Animates the color of the brush used to paint              the second button from red to blue . -->                            <EventTrigger RoutedEvent="TextBox.GotFocus">                                <BeginStoryboard>                                    <Storyboard>                                        <DoubleAnimation                    Storyboard.TargetName="BarcodeBrushName"                  Storyboard.TargetProperty="Opacity"                                         AutoReverse="True"                                        RepeatBehavior="Forever"                  From="0" To="0.3" Duration="0:0:0.5" />                                    </Storyboard>                                </BeginStoryboard>                            </EventTrigger>                            <EventTrigger RoutedEvent="TextBox.LostFocus">                                <BeginStoryboard>                                    <Storyboard>                                        <DoubleAnimation                    Storyboard.TargetName="BarcodeBrushName"                  Storyboard.TargetProperty="Opacity"                                        AutoReverse="False"                  From="0.3" To="0.1" Duration="0:0:0.1" />                                    </Storyboard>                                </BeginStoryboard>                            </EventTrigger>                        </TextBox.Triggers>                     </TextBox>                </Grid>            </StackPanel>            <TextBlock Text="{Binding RecipeInfo}" Margin="0,5,17,5" HorizontalAlignment="Right" VerticalAlignment="Center" TextAlignment="Right" Width="142" Visibility="{Binding RecipeInfoTextVisibility}" />        </Grid>        <xctk:DataGridControl Grid.Row="1" x:Name="dataGrid1" ItemsSource="{Binding Source={StaticResource recipeData}}" FontSize="13"                              AutoCreateColumns="False" Background="#FFC5D0D8"                              ItemsPrimaryAxis="Horizontal" PagingBehavior="LeftToRight"                               UpdateSourceTrigger="CellContentChanged" Grid.RowSpan="2" BorderThickness="0.5" SelectionUnit="Cell">            <i:Interaction.Triggers>                <i:EventTrigger EventName="MouseRightButtonDown">                    <i:InvokeCommandAction Command="{Binding RightClickCommand}" />                </i:EventTrigger>            </i:Interaction.Triggers>            <xctk:DataGridControl.View>                <xctk:TableflowView FixedColumnCount="1" ContainerHeight="25" x:Name="tblView"                                        VerticalGridLineThickness="0.5" HorizontalGridLineBrush="Gray"                                         HorizontalGridLineThickness="0.5" VerticalGridLineBrush="Black"                                         RowFadeInAnimationDuration="0"                                          ScrollingAnimationDuration="0" ColumnStretchMinWidth="10"                                         DetailIndicatorWidth="20" ShowRowSelectorPane="False"                                         ShowScrollTip="False" UseDefaultHeadersFooters="False">                    <xctk:TableflowView.FixedHeaders>                        <DataTemplate>                            <xctk:ColumnManagerRow AllowColumnReorder="False" AllowColumnResize="True" AllowDrop="False" AllowSort="False" />                        </DataTemplate>                    </xctk:TableflowView.FixedHeaders>                    <xctk:TableView.Theme>                        <!--<xctk:LunaNormalColorTheme/>-->                        <xctk:ZuneNormalColorTheme />                    </xctk:TableView.Theme>                </xctk:TableflowView>            </xctk:DataGridControl.View>            <xctk:DataGridControl.DefaultCellEditors>                <xctk:CellEditor x:Key="{x:Type app:SmartCellData}">                    <xctk:CellEditor.EditTemplate>                        <DataTemplate>                            <app:SmartCellEditor Content="{xctk:CellEditorBinding}">                                <i:Interaction.Triggers>                                    <i:EventTrigger EventName="Loaded">                                        <i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource AncestorType=xctk:DataGridControl},Path=DataContext.SmartCellEditorLoadedCommand}"                                                                CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=app:SmartCellEditor},Path=DataContext}" />                                    </i:EventTrigger>                                    <i:EventTrigger EventName="Unloaded">                                        <i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource AncestorType=xctk:DataGridControl},Path=DataContext.SmartCellEditorUnloadedCommand}"                                                                CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=app:SmartCellEditor},Path=DataContext}" />                                    </i:EventTrigger>                                </i:Interaction.Triggers>                            </app:SmartCellEditor>                        </DataTemplate>                    </xctk:CellEditor.EditTemplate>                </xctk:CellEditor>            </xctk:DataGridControl.DefaultCellEditors>        </xctk:DataGridControl>    </Grid></UserControl>
 |