Copy and Paste DataGridItem

<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" backgroundColor="#323232" styleName="plain" width="100%" height="100%" verticalAlign="middle" horizontalAlign="center">

<mx:Script>
<![CDATA[
private function updateMenu(index:Number):void
{
lastRollOverIndex = index;

// only enable the Copy menu item when the user is over a row in the DataGrid
if (isNaN(lastRollOverIndex))
{
menuItems.getItemAt(0).enabled = false;
}
else
{
menuItems.getItemAt(0).enabled = true;
}

cMenu.dataProvider = menuItems;
dg.flexContextMenu = cMenu;
}

private function handleMenuClick(index:int):void
{
if (index == 0)
{
// add the data to the clipboard
Clipboard.generalClipboard.clear();
var cs:String = dg.dataProvider[lastRollOverIndex].firstName + "\t" + dg.dataProvider[lastRollOverIndex].lastName + "\t" + dg.dataProvider[lastRollOverIndex].phone + "\r\n";
Clipboard.generalClipboard.setData(ClipboardFormats.TEXT_FORMAT, cs);
}
else if (index == 1)
{
// read the data from the Clipboard
if (Clipboard.generalClipboard.hasFormat(ClipboardFormats.TEXT_FORMAT))
{
var a:Array;
var s:String = new String(Clipboard.generalClipboard.getData(ClipboardFormats.TEXT_FORMAT));

// split the Clipboard string into an array
if (s.indexOf("\t") >= 0)
a = s.split("\t");
else if (s.indexOf(" ") >= 0)
a = s.split(" ");
else
a = [s];

// assign the Array items to a new Object
var o:Object = new Object();
if (a.length > 2)
o.phone = a[2];

if (a.length > 1)
o.lastName = a[1];

if (a.length > 0)
{
o.firstName = a[0];

// add the item to the DataGrid
people.addItem(o);
}
}
}
}


]]>
</mx:Script>

<mx:Number id="lastRollOverIndex"/>

<mx:ArrayCollection id="menuItems">
<mx:Object label="Copy"/>
<mx:Object label="Paste"/>
</mx:ArrayCollection>

<mx:ArrayCollection id="people">
<mx:Object firstName="James" lastName="Ward" phone="555-123-1234"/>
<mx:Object firstName="Greg" lastName="Wilson" phone="555-987-6543"/>
<mx:Object firstName="Christophe" lastName="Coenraets" phone="555-432-5678"/>
</mx:ArrayCollection>
<mx:Label text="Right click for copy/paste menu" color="white"/>
<mx:FlexNativeMenu id="cMenu" labelField="label" itemClick="handleMenuClick(event.index)"/>

<mx:DataGrid id="dg" dataProvider="{people}" itemRollOver="updateMenu(event.rowIndex)" itemRollOut="updateMenu(NaN)"/>

</mx:Module>
<UserControl x:Class="MECF.Framework.UI.Client.CenterViews.Editors.Recipe.RecipeEditorDetailView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:controls="clr-namespace:OpenSEMI.Ctrlib.Controls" xmlns:converters="clr-namespace:Aitex.Core.UI.Converters;assembly=MECF.Framework.UI.Core" xmlns:converters1="clr-namespace:MECF.Framework.UI.Client.Converter" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:dgExtension="clr-namespace:RecipeEditorLib.DGExtension" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:micro="clr-namespace:Caliburn.Micro" xmlns:Converter="clr-namespace:MECF.Framework.UI.Client.Ctrlib.Converter" d:DesignHeight="768" d:DesignWidth="1200" Background="White" mc:Ignorable="d"> <UserControl.Resources> <converters:TrimFolderConverter1 x:Key="TrimFolderConverter1"/> <converters:StringPreservesLengthConvertor x:Key="stringPreservesLengthConvertor"/> <converters:BorderBrushCustomConvertor x:Key="BorderBrushCustomConvertor"/> <converters:BorderThicknessCustomConvertor x:Key="BorderThicknessCustomConvertor"/> <converters1:RecipeTypeToConverter x:Key="recipeTypeToConverter"/> <converters1:RecipeConfigLabelBackgroundCoverter x:Key="recipeConfigLabelBackgroundCoverter"/> <ControlTemplate x:Key="TemplateStep"> <Grid> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Foreground="Black" Text="{Binding Value}"/> </Grid> </ControlTemplate> <ControlTemplate x:Key="ParamTemplate"> <Grid Margin="0,5"> <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="Arial" FontSize="16" Text="{Binding DisplayName}"/> </Grid> </ControlTemplate> <ControlTemplate x:Key="ParamTemplateByControlName"> <Grid Margin="0,5"> <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="Arial" FontSize="16" Text="{Binding ControlName}"/> </Grid> </ControlTemplate> <ControlTemplate x:Key="TemplateText"> <Grid> <controls:EditTextBlock AllowBackgroundChange="True" CanInputSpace="False" Foreground="Black" IsEnabled="{Binding IsEnabled}" Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" TextSaved="{Binding IsSaved, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> </Grid> </ControlTemplate> <ControlTemplate x:Key="TemplateNumber"> <Grid> <controls:EditTextBlock Padding="5,3" AllowBackgroundChange="True" EditBoxMode="Decimal" Foreground="Black" IsEnabled="{Binding IsEnabled}" MaxValue="{Binding Maximun}" MinValue="{Binding Minimun}" RefreshControl="{Binding RefreshControl, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" TextSaved="{Binding IsSaved, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ToolTip="{Binding ToolText}"/> </Grid> </ControlTemplate> <ControlTemplate x:Key="TemplateCombox"> <Grid> <controls:ComboTextBlock AllowBackgroundChange="True" Background="{Binding LoopBackground}" Foreground="Black" IsEditable="{Binding IsEditable}" IsEnabled="{Binding IsEnabled}" IsLoopItem="{Binding IsLoopItem}" ItemsSource="{Binding Options}" Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" TextSaved="{Binding IsSaved, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> </Grid> </ControlTemplate> <ControlTemplate x:Key="TemplateRecipeSelection"> <Grid> <TextBlock Foreground="White" IsEnabled="{Binding IsEnabled}" Text="{Binding Value}"> <i:Interaction.Triggers> <i:EventTrigger EventName="MouseLeftButtonDown"> <micro:ActionMessage MethodName="PopSetting"> <micro:Parameter Value="{Binding Name}"/> <micro:Parameter Value="{Binding}"/> </micro:ActionMessage> </i:EventTrigger> </i:Interaction.Triggers> </TextBlock> </Grid> </ControlTemplate> <ControlTemplate x:Key="TemplateRecipeSelection2"> <Grid> <TextBlock Height="25" Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource stringPreservesLengthConvertor}, ConverterParameter=30}" Visibility="{Binding Visible}"> <i:Interaction.Triggers> <i:EventTrigger EventName="MouseLeftButtonDown"> <micro:ActionMessage MethodName="SelectRecipe"> <micro:Parameter Value="{Binding}"/> </micro:ActionMessage> </i:EventTrigger> </i:Interaction.Triggers> </TextBlock> </Grid> </ControlTemplate> <ControlTemplate x:Key="TemplatePopSetting"> <Grid> <!-- Background="{Binding Value, Converter={StaticResource recipeConfigLabelBackgroundCoverter}}" --> <TextBlock Height="25" IsEnabled="{Binding IsEnabled}" Text="{Binding Value}"> <i:Interaction.Triggers> <i:EventTrigger EventName="MouseLeftButtonDown"> <micro:ActionMessage MethodName="PopSetting"> <micro:Parameter Value="{Binding Name}"/> <micro:Parameter Value="{Binding}"/> </micro:ActionMessage> </i:EventTrigger> </i:Interaction.Triggers> </TextBlock> </Grid> </ControlTemplate> <Converter:GetRecipeConfigButtonConverter x:Key="getRecipeConfigButtonConverter"/> </UserControl.Resources> <Grid Margin="10,0"> <Grid.RowDefinitions> <RowDefinition Height="60"/> <RowDefinition Height="*"/> <RowDefinition/> </Grid.RowDefinitions> <Grid Grid.Row="0"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Button Width="60" Margin="10,0" Command="{Binding PreCommand}" Content="Pre"/> <Border Grid.Column="2" Margin="10,2,10,0" Style="{DynamicResource Sub_Menu_BarStyle}"> <Grid Width="190"> <Grid.ColumnDefinitions> <ColumnDefinition Width="90"/> <ColumnDefinition Width="100"/> </Grid.ColumnDefinitions> <Border BorderBrush="Gray" BorderThickness="1"> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="Recipe Status"/> </Border> <Border Grid.Column="1" BorderBrush="Gray" BorderThickness="0,1,1,1"> <Border.Style> <Style TargetType="Border"> <Setter Property="Background" Value="Transparent"/> <Style.Triggers> <DataTrigger Binding="{Binding IsValid, Mode=OneWay}" Value="Invalid"> <Setter Property="Background" Value="Red"/> </DataTrigger> </Style.Triggers> </Style> </Border.Style> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding IsValid, Mode=OneWay}"/> </Border> </Grid> </Border> <Button Grid.Column="3" Width="95" Margin="-10.5,0,15,0" Command="{Binding CheckCommand}" Content="ValidCheck"/> <UniformGrid Grid.Column="4" Rows="1"> <Button Command="{Binding AppendCommand}" Content="Append" IsEnabled="{Binding BtnIsNanoAEnabled}"/> <Button Command="{Binding InsertCommand}" CommandParameter="{Binding ElementName=dgCustom, Path=SelectedItem}" Content="Insert" IsEnabled="{Binding BtnIsNanoAEnabled}"/> <Button Command="{Binding CopyCommand}" CommandParameter="{Binding ElementName=dgCustom, Path=SelectedItems}" Content="Copy" IsEnabled="{Binding BtnIsNanoAEnabled}"/> <Button Command="{Binding PasteCommand}" CommandParameter="{Binding ElementName=dgCustom, Path=SelectedItem}" Content="Paste" IsEnabled="{Binding BtnIsNanoAEnabled}"/> <Button Command="{Binding ReloadCommand}" Content="Reload"/> <Button x:Name="BtnSaveRecipe" Command="{Binding SaveCommand}" Content="Save"/> <Button Command="{Binding DeleteCommand}" CommandParameter="{Binding ElementName=dgCustom, Path=SelectedItems}" Content="Delete"/> </UniformGrid> </Grid> <TabControl Margin="0,5,0,-350" Grid.Row="1"> <TabItem Header="Header"> <StackPanel> <Grid x:Name="gridHeader" HorizontalAlignment="Left" IsEnabled="{Binding IsPermission}"> <Grid.ColumnDefinitions> <ColumnDefinition Width="150"/> <ColumnDefinition Width="280"/> <ColumnDefinition Width="200"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="40"/> <RowDefinition Height="40"/> <RowDefinition Height="40"/> <RowDefinition Height="40"/> <RowDefinition Height="40"/> <RowDefinition Height="40"/> <RowDefinition Height="40"/> <RowDefinition Height="{Binding TemperatureHeight}"/> </Grid.RowDefinitions> <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1" Background="{DynamicResource Table_BG_Title}" Padding="5,1"> <TextBlock Text="Name" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="16" FontFamily="Arial" VerticalAlignment="Center"/> </Border> <Border Grid.Column="1" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1"> <controls:TextBoxEx AllowBackgroundChange="False" IsEnabled="False" Text="{Binding RecipeTable.RecipeData.Name}" TextWrapping="Wrap" VerticalAlignment="Stretch" MinWidth="100" Width="Auto"/> </Border> <Border Grid.Row="0" Grid.Column="2" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1"> <TextBlock Text="{Binding RecipeTable.RecipeData.Index,UpdateSourceTrigger=PropertyChanged}"/> </Border> <Border Grid.Row="1" Grid.Column="0" BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1"> <TextBlock Text="RecipePMGroup" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="16" FontFamily="Arial" VerticalAlignment="Center"/> </Border> <Border Grid.Row="1" Grid.Column="1" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1"> <controls:ComboTextBlock Height="30" ItemsSource="{Binding AllRecipePMGroup}" TextSaved="{Binding RecipeTable.RecipeData.RecipePMGroup.IsSaved,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Text="{Binding RecipeTable.RecipeData.RecipePMGroup.Value,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Stretch" Foreground="{DynamicResource FG_Black}" FontSize="14" FontFamily="Arial" VerticalAlignment="Stretch" IsEnabled="{Binding EnableHeader}" MinWidth="100" Width="Auto"/> </Border> <Border Grid.Row="1" Grid.Column="2" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1"> </Border> <Border Grid.Row="2" BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1"> <TextBlock Text="Description" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="16" FontFamily="Arial" VerticalAlignment="Center"/> </Border> <Border Grid.Row="2" Grid.Column="1" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1"> <controls:TextBoxEx Text="{Binding RecipeTable.RecipeData.Description, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" TextSaved="{Binding RecipeTable.RecipeData.IsSavedDesc, Mode=TwoWay}" IsEnabled="{Binding EnableHeader}" TextWrapping="Wrap" VerticalAlignment="Stretch" MinWidth="100" Width="Auto"/> </Border> <Border Grid.Row="2" Grid.Column="2" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1"> </Border> <Border Grid.Row="3" BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1"> <TextBlock Text="Chamber Type" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="16" FontFamily="Arial" VerticalAlignment="Center"/> </Border> <Border Grid.Row="3" Grid.Column="1" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1"> <TextBlock IsEnabled="False" Text="{Binding RecipeTable.RecipeData.RecipeChamberType}" TextWrapping="Wrap" VerticalAlignment="Stretch" MinWidth="100" Width="Auto"/> </Border> <Border Grid.Row="3" Grid.Column="2" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1"> </Border> <Border Grid.Row="4" BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1"> <TextBlock Text="Format Version" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="16" FontFamily="Arial" VerticalAlignment="Center"/> </Border> <Border Grid.Row="4" Grid.Column="1" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1"> <TextBlock Text="{Binding RecipeTable.RecipeData.RecipeVersion}" TextWrapping="Wrap" VerticalAlignment="Stretch" MinWidth="100" Width="Auto"/> </Border> <Border Grid.Row="4" Grid.Column="2" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1"> </Border> <Border Grid.Row="5" Grid.Column="0" BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1"> <TextBlock Text="Create" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="16" FontFamily="Arial" VerticalAlignment="Center"/> </Border> <Border Grid.Row="5" Grid.Column="1" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1"> <TextBlock Text="{Binding RecipeTable.RecipeData.Creator}" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="14" FontFamily="Arial" VerticalAlignment="Stretch" MinWidth="100" Width="Auto"/> </Border> <Border Grid.Row="5" Grid.Column="2" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1"> <TextBlock Text="{Binding RecipeTable.RecipeData.CreateTime, StringFormat=yyyy/MM/dd HH:mm:ss}" HorizontalAlignment="Left" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="14" FontFamily="Arial" VerticalAlignment="Center" MinWidth="100" Width="Auto"/> </Border> <Border Grid.Row="6" Grid.Column="0" BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1"> <TextBlock Text="Revise" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="16" FontFamily="Arial" VerticalAlignment="Center"/> </Border> <Border Grid.Row="6" Grid.Column="1" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1"> <TextBlock Text="{Binding RecipeTable.RecipeData.Revisor}" HorizontalAlignment="Left" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="14" FontFamily="Arial" VerticalAlignment="Center" Width="120"/> </Border> <Border Grid.Row="6" Grid.Column="2" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1"> <TextBlock Text="{Binding RecipeTable.RecipeData.ReviseTime, StringFormat=yyyy/MM/dd HH:mm:ss}" HorizontalAlignment="Left" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="14" FontFamily="Arial" VerticalAlignment="Center" MinWidth="140"/> </Border> <Border Grid.Row="7" Grid.Column="0" BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1"> <TextBlock Text="Temperature" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="16" FontFamily="Arial" VerticalAlignment="Center"/> </Border> <Border Grid.Row="7" Grid.Column="1" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1"> <controls:TextBoxEx Text="{Binding RecipeTable.RecipeData.Temperature, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding EnableHeader}" TextWrapping="Wrap" VerticalAlignment="Stretch" MinWidth="100" Width="Auto"/> </Border> <Border Grid.Row="7" Grid.Column="2" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1"> <TextBlock Text="{Binding RecipeTable.RecipeData.Temperature}" HorizontalAlignment="Left" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="14" FontFamily="Arial" VerticalAlignment="Center" MinWidth="140"/> </Border> </Grid> <DataGrid Grid.Row="1" AlternationCount="2" HorizontalAlignment="Left" CanUserAddRows="False" AutoGenerateColumns="False" RowHeaderWidth="0" RowHeight="38" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling" ItemsSource="{Binding RecipeTable.RecipeData.ConfigItems}" Margin="0,5,0,0" IsEnabled="{Binding IsPermission}"> <DataGrid.CellStyle> <Style TargetType="DataGridCell"> <Style.Setters> <Setter Property="Height" Value="40"/> </Style.Setters> </Style> </DataGrid.CellStyle> <DataGrid.Columns> <DataGridTemplateColumn Header="Config Item" MinWidth="300"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding DisplayName}" Margin="5,0,0,0" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center"/> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> <DataGridTemplateColumn Header="Value" MinWidth="220"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <Grid ToolTip="{Binding FileName}" VerticalAlignment="Center"> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <controls:TextBoxEx Visibility="{Binding TextBoxVisibility}" TextSaved="{Binding IsSaved, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding IsEnabled}" Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource TrimFolderConverter1}}" FontSize="14" Width="Auto" VerticalContentAlignment="Top"/> <Button Grid.Column="1" Visibility="{Binding ButtonVisibility}" Width="70" Height="30"> <TextBlock FontSize="14" Text="{Binding Converter={StaticResource getRecipeConfigButtonConverter}}" Foreground="White" FontFamily="Arial,SimSun"/> <i:Interaction.Triggers> <i:EventTrigger EventName="Click"> <micro:ActionMessage MethodName="SelectRecipe"> <micro:Parameter Value="{Binding}" /> </micro:ActionMessage> </i:EventTrigger> </i:Interaction.Triggers> </Button> <controls:ComboTextBlock Grid.ColumnSpan="2" Foreground="Black" IsEnabled="{Binding IsEnabled}" Visibility="{Binding ComboBoxVisibility}" Background="{Binding LoopBackground }" IsLoopItem="{Binding IsLoopItem }" TextSaved="{Binding IsSaved,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding Options}" AllowBackgroundChange="True" Text="{Binding Value,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ></controls:ComboTextBlock> </Grid> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> </DataGrid.Columns> </DataGrid> </StackPanel> </TabItem> <TabItem Header="Steps" IsSelected="True" HorizontalAlignment="Left" Width="60" > <DataGrid x:Name="dgCustom" Grid.Row="2" AlternationCount="1" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeColumns="True" CanUserResizeRows="False" CanUserSortColumns="False" EnableColumnVirtualization="True" EnableRowVirtualization="True" FrozenColumnCount="2" GridLinesVisibility="All" HeadersVisibility="Column" ItemsSource="{Binding RecipeTable.RecipeData.ViewSteps}" RowHeight="30" ScrollViewer.CanContentScroll="False" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" SelectedItem="{Binding SelectedStep}" SelectionMode="Extended" SelectionUnit="FullRow" Validation.ErrorTemplate="{x:Null}" VirtualizingPanel.CacheLengthUnit="Item" VirtualizingPanel.IsContainerVirtualizable="True" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling"> <DataGrid.Resources> <Style TargetType="DataGridCell"> <Setter Property="Padding" Value="0"/> <Setter Property="VerticalContentAlignment" Value="Center"/> </Style> </DataGrid.Resources> <DataGrid.Columns> <DataGridTextColumn Binding="{Binding StepNo}" Header="Step" Width="Auto" IsReadOnly="True"/> </DataGrid.Columns> <DataGrid.CellStyle> <Style TargetType="DataGridCell"> <Setter Property="BorderThickness" Value="0"/> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/> <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/> </Trigger> </Style.Triggers> </Style> </DataGrid.CellStyle> </DataGrid> </TabItem> </TabControl> <!--<DataGrid x:Name="dgCustom" Grid.Row="2" AlternationCount="1" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeColumns="True" CanUserResizeRows="False" CanUserSortColumns="False" EnableColumnVirtualization="True" EnableRowVirtualization="True" FrozenColumnCount="2" GridLinesVisibility="All" HeadersVisibility="Column" ItemsSource="{Binding RecipeTable.RecipeData.ViewSteps}" RowHeight="30" ScrollViewer.CanContentScroll="False" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" SelectedItem="{Binding SelectedStep}" SelectionMode="Extended" SelectionUnit="FullRow" Validation.ErrorTemplate="{x:Null}" VirtualizingPanel.CacheLengthUnit="Item" VirtualizingPanel.IsContainerVirtualizable="True" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling"> <DataGrid.Resources> <Style TargetType="DataGridCell"> <Setter Property="Padding" Value="0"/> <Setter Property="VerticalContentAlignment" Value="Center"/> </Style> </DataGrid.Resources> <DataGrid.Columns> <DataGridTextColumn Binding="{Binding StepNo}" Header="Step" IsReadOnly="True"/> </DataGrid.Columns> </DataGrid>--> </Grid> </UserControl>中的<Border Grid.Column="1" BorderBrush="Gray" BorderThickness="0,1,1,1"> <Border.Style> <Style TargetType="Border"> <Setter Property="Background" Value="Transparent"/> <Style.Triggers> <DataTrigger Binding="{Binding IsValid, Mode=OneWay}" Value="Invalid"> <Setter Property="Background" Value="Red"/> </DataTrigger> </Style.Triggers> </Style> </Border.Style> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding IsValid, Mode=OneWay}"/> </Border>当有TextSaved变为false时,也会变成红色
最新发布
12-30
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值