Exemplo n.º 1
0
        private DiagramContext getContext()
        {
            if (_context == null)
            {
                var testCanvas = new DiagramCanvas();
                var diagramDef = new DiagramDefinition(null);
                foreach (var item in _items.Values)
                {
                    diagramDef.DrawItem(item);
                }

                var provider = new DrawingProvider(testCanvas, new TestDrawingFactory());
                _context = provider.Display(diagramDef);

                testCanvas.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
                testCanvas.Arrange(new Rect(new Point(), testCanvas.DesiredSize));
            }

            return(_context);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Draws the specified item for given instance.
 /// </summary>
 /// <param name="instance">Instance which is represented by given drawing item</param>
 /// <param name="item">Item drawing.</param>
 internal void DrawItem(DrawedInstance instance, DiagramItemDefinition item)
 {
     Context.DrawItem(item);
     _displayedInstances.Add(instance.WrappedInstance);
 }