Beispiel #1
0
        private void AddCopy(InkCanvas inkCanvas)
        {
            var strokeCollection = new StrokeCollection();

            foreach (var selectedStroke in _selectedStrokes)
            {
                var stroke = selectedStroke.Clone();
                strokeCollection.Add(stroke);
                inkCanvas.Strokes.Add(stroke);
            }
            var uiElementCollection = new List <UIElement>();

            foreach (UIElement selectedElement in _selectedElements)
            {
                var element = WPFHelper.Clone(selectedElement, inkCanvas);
                if (element == null)
                {
                    continue;
                }
                uiElementCollection.Add(element);
                inkCanvas.Children.Add(element);
                InkCanvas.SetLeft(element, InkCanvas.GetLeft(selectedElement));
                InkCanvas.SetTop(element, InkCanvas.GetTop(selectedElement));
            }
            _repetitions.Add(new Tuple <ReadOnlyCollection <UIElement>, StrokeCollection>(new ReadOnlyCollection <UIElement>(uiElementCollection), strokeCollection));
        }