public static DesignItem CreateDesignItem(DesignItemInfo designItemInfo)
        {
            var currentDate = DateTime.Now;
            designItemInfo.CreateDate = currentDate;
            designItemInfo.ModifyDate = currentDate;
            var shape = new Shape();
            var shapeInfoUnit = new ItemShapeInfoUnit(designItemInfo);
            shape.ShapeInfoUnit = shapeInfoUnit;
            shape.IsHitTestVisible = false;
            shape.Style = Application.Current.Resources[designItemInfo.StyleKey] as Style;
            if (designItemInfo.SvgBuffer != null)
            {
                using (var stream = new MemoryStream(designItemInfo.SvgBuffer))
                {
                    var svgDrawing = SvgHelper.CreateSvgImage(stream); //SvgHelper.CreateSvgViewBox(stream);
                    if (svgDrawing != null)
                    {
                        shapeInfoUnit.SvgDrawing = svgDrawing;
                        shape.SetBinding(Shape.ContentProperty, BindingHelper.CreateBinding(shapeInfoUnit, "SvgDrawing"));
                    }
                }
            }
            shape.SetBinding(Shape.TextProperty, BindingHelper.CreateBinding(designItemInfo, "Text"));
            if (!string.IsNullOrEmpty(designItemInfo.DesignInfo.Backgroud))
            {
                var brushConverter = new BrushConverter();
                shape.Background = (Brush)brushConverter.ConvertFromString(designItemInfo.DesignInfo.Backgroud);
            }
            var designItem = new DesignItem(designItemInfo.ID);
            designItem.ParentID = designItemInfo.ParentID;
            designItem.Content = shape;
            designItem.SetBinding(DesignItem.LinkButtonVisibilityProperty, BindingHelper.CreateBinding(designItemInfo, "LinkButtonVisibility"));
            designItem.SetBinding(DesignItem.WidthProperty, BindingHelper.CreateBinding(designItemInfo,"Width"));
            designItem.SetBinding(DesignItem.HeightProperty, BindingHelper.CreateBinding(designItemInfo, "Height"));
            designItem.SetBinding(DesignCanvas.LeftProperty, BindingHelper.CreateBinding(designItemInfo, "X"));
            designItem.SetBinding(DesignCanvas.TopProperty, BindingHelper.CreateBinding(designItemInfo, "Y"));
            designItem.SetBinding(DesignCanvas.ZIndexProperty, BindingHelper.CreateBinding(designItemInfo, "ZIndex"));

            return designItem;
        }
        private List<ShapeInfoUnit> GetSVGShapeInfoUnits()
        {
            var shapeInfoUnites = new List<ShapeInfoUnit>();
              var shapeInfoA = new ItemShapeInfo();
              shapeInfoA.ShapeType = ShapeType.DesignItem;
              shapeInfoA.ShapeCategory = ShapeCategory.Business;
              shapeInfoA.StyleKey = "SVGBusinessShapeStyle";
              shapeInfoA.Style = Application.Current.Resources["SVGBusinessShapeStyle"] as Style;
              shapeInfoA.ToolTip = "SVG";
              shapeInfoA.IsChecked = true;
              shapeInfoA.IsEnabled = true;
              shapeInfoA.SvgBuffer = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,@"Resources\Svg\Butterfly.svg"));
              var shapeInfoUnit = new ItemShapeInfoUnit(shapeInfoA);
              using (var stream = new MemoryStream(shapeInfoA.SvgBuffer))
              {
              shapeInfoUnit.SvgDrawing = SvgHelper.CreateSvgViewBox(stream);
              }
              shapeInfoUnites.Add(shapeInfoUnit);

              return shapeInfoUnites;
        }
 private ShapeInfoUnit[] ToShapeInfoUnites(DesignItemInfo[] designItemInfos)
 {
     return designItemInfos.Select(a =>
     {
         var shapeInfoUnit = new ItemShapeInfoUnit(a);
         if (a.SvgBuffer != null)
         {
             using (var stream = new MemoryStream(a.SvgBuffer))
             {
                 var svgDrawing = SvgHelper.CreateSvgViewBox(stream);
                 if (svgDrawing != null)
                 {
                     shapeInfoUnit.SvgDrawing = svgDrawing;
                 }
             }
         }
         return shapeInfoUnit;
     }
     ).ToArray();
 }