private void Copy_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            if (selectedItems.Count != 0)
            {
                List <ProjectElementBase> elements = new List <ProjectElementBase>();
                foreach (TreeViewItem i in selectedItems)
                {
                    if (i != null)
                    {
                        ProjectElementBase elem = i.Tag as ProjectElementBase;
                        elements.Add(elem);
                    }
                }

                ClipboardBufferData data = new ClipboardBufferData(ClipboardOperationType.Copy, elements);
                if (ClipboardBufferData.CanSendToClipboard(data))
                {
                    ClipboardBufferData.SendToClipboard(data);
                }

                foreach (TreeViewItem i in selectedItems)
                {
                    if (i != null)
                    {
                        ProjectElementBase elem = i.Tag as ProjectElementBase;
                        elem.Copy_Executed(sender, e);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override void Paste_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            if (ClipboardBufferData.CanGetFromClipboard() == true)
            {
                ClipboardBufferData data = ClipboardBufferData.GetFromClipboard();
                ClipboardBufferData.SendToClipboard(data);

                bool res = CanPaste(data);
                if (res == true)
                {
                    e.CanExecute = true;
                }
            }
        }