Mini Kabibi Habibi
<local:GridDemoModule x:Class="GridDemo.CopyPaste"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxgt="http://schemas.devexpress.com/winfx/2008/xaml/grid/themekeys"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxdb="http://schemas.devexpress.com/winfx/2008/xaml/demobase"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:local="clr-namespace:GridDemo"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" d:DesignHeight="400" d:DesignWidth="800"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<local:GridDemoModule.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/GridDemo;component/ModuleResources/CopyPasteTemplates.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</local:GridDemoModule.Resources>
<dxdb:DemoModuleControl SupressGroupFramePaddingInOptions="False">
<dxdb:DemoModuleControl.OptionsContent>
<StackPanel>
<StackPanel.CommandBindings>
<CommandBinding Command="ApplicationCommands.Copy" Executed="CopyCommandBinding_Executed" CanExecute="CopyCommandBinding_CanExecute"/>
<CommandBinding Command="ApplicationCommands.Cut" Executed="CutCommandBinding_Executed" CanExecute="CutCommandBinding_CanExecute"/>
<CommandBinding Command="ApplicationCommands.Paste" Executed="PasteCommandBinding_Executed" CanExecute="PasteCommandBinding_CanExecute"/>
<CommandBinding Command="ApplicationCommands.Delete" Executed="DeleteCommandBinding_Executed" CanExecute="DeleteCommandBinding_CanExecute"/>
</StackPanel.CommandBindings>
<dxe:CheckEdit x:Name="allowCopyingtoClipboardCheckEdit" Checked="allowCopyingtoClipboardCheckEdit_Checked" Unchecked="allowCopyingtoClipboardCheckEdit_Unchecked" Content="Allow Copying to Clipboard" Focusable="False"/>
<dxe:CheckEdit Margin="0,4,0,0" x:Name="copyHeaderCheckEdit" Checked="copyHeaderCheckEdit_Checked" Unchecked="copyHeaderCheckEdit_Unchecked" Content="Copy Header" Focusable="False"/>
<dx:GroupFrame Margin="0,12,0,0" Header="Paste Rows">
<StackPanel Orientation="Vertical">
<dxe:ListBoxEdit Margin="0,0,30,0" x:Name="PasteRule"
SelectedIndex="{Binding Path=PastUnderFocusedRow, Converter={local:PastUnderFocusedRowToSelectedIndexConverter}, Mode=TwoWay}"
Background="{x:Null}" ShowBorder="False">
<dxe:ListBoxEdit.StyleSettings>
<dxe:RadioListBoxEditStyleSettings/>
</dxe:ListBoxEdit.StyleSettings>
<dxe:ListBoxEdit.Items>
<sys:String>After Focused Row</sys:String>
<sys:String>After All Rows</sys:String>
</dxe:ListBoxEdit.Items>
</dxe:ListBoxEdit>
</StackPanel>
</dx:GroupFrame>
<Button Name="CopyButton" Margin="0,12,0,0" Content="Copy" Command="ApplicationCommands.Copy" Focusable="False"/>
<Button Name="CutButton" Margin="0,4,0,0" Content="Cut" Command="ApplicationCommands.Cut" Focusable="False"/>
<Button Name="PasteButton" Margin="0,4,0,0" Content="Paste" Command="ApplicationCommands.Paste" Focusable="False"/>
<Button Name="DeleteButton" Margin="0,4,0,0" Content="Delete" Command="ApplicationCommands.Delete" Focusable="False"/>
</StackPanel>
</dxdb:DemoModuleControl.OptionsContent>
<dxb:BarManager>
<dxb:BarManager.Items>
<dxb:BarButtonItem Name="gridCopy" Content="Copy" Command="ApplicationCommands.Copy"/>
<dxb:BarButtonItem Name="gridCut" Content="Cut" Command="ApplicationCommands.Cut" />
<dxb:BarButtonItem Name="gridPaste" Content="Paste" Command="ApplicationCommands.Paste" />
<dxb:BarButtonItem Name="gridDelete" Content="Delete" Command="ApplicationCommands.Delete" />
</dxb:BarManager.Items>
<Grid Margin="12" x:Name="DemoContentGrid">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" Padding="5" Margin="-5" Background="{Binding Path=FocusedGrid, ConverterParameter=First, Converter={local:FocusedToColorConverter}}">
<dxg:GridControl x:Name="firstGrid" CustomUnboundColumnData="Grid_CustomUnboundColumnData" DesignTimeDataObjectType="local:CopyPasteOutlookData" SelectionMode="Row">
<dxg:GridControl.CommandBindings>
<CommandBinding Command="ApplicationCommands.Copy" Executed="CopyCommandBinding_Executed" CanExecute="CopyCommandBinding_CanExecute"/>
<CommandBinding Command="ApplicationCommands.Cut" Executed="CutCommandBinding_Executed" CanExecute="CutCommandBinding_CanExecute"/>
<CommandBinding Command="ApplicationCommands.Paste" Executed="PasteCommandBinding_Executed" CanExecute="PasteCommandBinding_CanExecute"/>
<CommandBinding Command="ApplicationCommands.Delete" Executed="DeleteCommandBinding_Executed" CanExecute="DeleteCommandBinding_CanExecute"/>
</dxg:GridControl.CommandBindings>
<dxb:BarManager.DXContextMenu>
<dxb:PopupMenu x:Name="firstPopupMenu">
<dxb:BarButtonItemLink BarItemName="gridCopy"/>
<dxb:BarButtonItemLink BarItemName="gridCut"/>
<dxb:BarButtonItemLink BarItemName="gridPaste"/>
<dxb:BarButtonItemLink BarItemName="gridDelete"/>
</dxb:PopupMenu>
</dxb:BarManager.DXContextMenu>
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="OID" Header="Id" MinWidth="50" Width="50" ReadOnly="true"/>
<dxg:GridColumn FieldName="From" MinWidth="100" Width="100" />
<dxg:GridColumn FieldName="Sent" MinWidth="100" Width="100" GroupInterval="DateRange"
EditSettings="{dxe:DateSettings DisplayFormat=d}" AutoFilterCondition="Equals"/>
<dxg:GridColumn FieldName="HoursActive" MinWidth="70" Width="70" AutoFilterCondition="Like"/>
<dxg:GridColumn FieldName="HasAttachment" MinWidth="50" Width="50" AutoFilterCondition="Equals"/>
<dxg:GridColumn FieldName="AnimationElement" UnboundType="Object" Visible="False" ShowInColumnChooser="False" AllowColumnFiltering="False"/>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView RowMinHeight="0" NavigationStyle="Row" AutoWidth="True" ShowGroupPanel="False" AllowGrouping="False"
AllowSorting="False" AllowColumnFiltering="False" DataRowTemplate="{StaticResource rowTemplate}">
<dxg:TableView.RowCellMenuCustomizations>
<dxb:BarButtonItem Name="viewFirstCopy" Content="Copy" Command="ApplicationCommands.Copy"/>
<dxb:BarButtonItem Name="viewFirstCut" Content="Cut" Command="ApplicationCommands.Cut"/>
<dxb:BarButtonItem Name="viewFirstPaste" Content="Paste" Command="ApplicationCommands.Paste"/>
<dxb:BarButtonItem Name="viewFirstDelete" Content="Delete" Command="ApplicationCommands.Delete"/>
</dxg:TableView.RowCellMenuCustomizations>
</dxg:TableView>
</dxg:GridControl.View>
</dxg:GridControl>
</Border>
<TabControl Name="CopyPasteDemoTabControl" Grid.Row="1" Margin="0,12,0,0">
<TabItem Header="Grid">
<Border Padding="5" Margin="-5" Background="{Binding Path=FocusedGrid, ConverterParameter=Second, Converter={local:FocusedToColorConverter}}">
<dxg:GridControl x:Name="secondGrid" CustomUnboundColumnData="Grid_CustomUnboundColumnData" DesignTimeDataObjectType="local:CopyPasteOutlookData" SelectionMode="Row">
<dxg:GridControl.CommandBindings>
<CommandBinding Command="ApplicationCommands.Copy" Executed="CopyCommandBinding_Executed" CanExecute="CopyCommandBinding_CanExecute"/>
<CommandBinding Command="ApplicationCommands.Cut" Executed="CutCommandBinding_Executed" CanExecute="CutCommandBinding_CanExecute"/>
<CommandBinding Command="ApplicationCommands.Paste" Executed="PasteCommandBinding_Executed" CanExecute="PasteCommandBinding_CanExecute"/>
<CommandBinding Command="ApplicationCommands.Delete" Executed="DeleteCommandBinding_Executed" CanExecute="DeleteCommandBinding_CanExecute"/>
</dxg:GridControl.CommandBindings>
<dxb:BarManager.DXContextMenu>
<dxb:PopupMenu x:Name="secondPopupMenu">
<dxb:BarButtonItemLink BarItemName="gridCopy"/>
<dxb:BarButtonItemLink BarItemName="gridCut"/>
<dxb:BarButtonItemLink BarItemName="gridPaste"/>
<dxb:BarButtonItemLink BarItemName="gridDelete"/>
</dxb:PopupMenu>
</dxb:BarManager.DXContextMenu>
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="OID" Header="Id" MinWidth="50" Width="50" ReadOnly="true"/>
<dxg:GridColumn FieldName="From" MinWidth="100" Width="100" />
<dxg:GridColumn FieldName="Sent" MinWidth="100" Width="100" GroupInterval="DateRange"
EditSettings="{dxe:DateSettings DisplayFormat=d}" AutoFilterCondition="Equals"/>
<dxg:GridColumn FieldName="HoursActive" MinWidth="70" Width="70" AutoFilterCondition="Like"/>
<dxg:GridColumn FieldName="HasAttachment" MinWidth="50" Width="50" AutoFilterCondition="Equals"/>
<dxg:GridColumn FieldName="AnimationElement" UnboundType="Object" Visible="False" ShowInColumnChooser="False" AllowColumnFiltering="False"/>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView RowMinHeight="0" NavigationStyle="Row" AutoWidth="True" ShowGroupPanel="False"
AllowSorting="False" AllowColumnFiltering="False" AllowGrouping="False"
DataRowTemplate="{StaticResource rowTemplate}">
<dxg:TableView.RowCellMenuCustomizations>
<dxb:BarButtonItem Name="viewSecondCopy" Content="Copy" Command="ApplicationCommands.Copy"/>
<dxb:BarButtonItem Name="viewSecondCut" Content="Cut" Command="ApplicationCommands.Cut"/>
<dxb:BarButtonItem Name="viewSecondPaste" Content="Paste" Command="ApplicationCommands.Paste"/>
<dxb:BarButtonItem Name="viewSecondDelete" Content="Delete" Command="ApplicationCommands.Delete"/>
</dxg:TableView.RowCellMenuCustomizations>
</dxg:TableView>
</dxg:GridControl.View>
</dxg:GridControl>
</Border>
</TabItem>
<TabItem Header="Text">
<dxe:TextEdit x:Name="textEdit" AcceptsReturn="True" VerticalContentAlignment="Top" VerticalScrollBarVisibility="Visible"/>
</TabItem>
</TabControl>
</Grid>
</dxb:BarManager>
</dxdb:DemoModuleControl>
</local:GridDemoModule>