I currently use GoDiagram v3 (GoDiagram for Net v3.0.3.3), i have problems using sub object with GoXmlBindingTransformer. All direct properties of the object is saved perfectly but properties of childrens of my main object have problems when i reload it, i can’t see why.
t.IdAttributeUsedForSharedObjects = true;
t.HandlesNamedPorts = true;
t.AddBinding("Size", "Size");
t.AddBinding("Location", "Location");
//t.AddBinding("ObjBrushColor", "drawingPart.BrushColor");
t.AddBinding("ObjBrushColor", "ObjBrushColor");
rw.AddTransformer(t);
...
...
ISwRootDrawingObj testObj = new ISwRootDrawingObj(GoFigure.Ellipse, new SizeF(100, 100));
testObj.drawingPart.BrushColor = Color.Black;
myPalette.Document.Add(testObj);
...
}
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Collections;
using System.Resources;
using System.Windows.Forms;
{
[Serializable]
public class ISwRootDrawingObj : GoGroup
public ISwRootDrawingObj()
: base()
{
drawingPart = new GoDrawing(GoFigure.Ellipse);
drawingPart.Selectable = false;
Add(drawingPart);
}
{
drawingPart = new GoDrawing(f);
drawingPart.Selectable = false;
Add(drawingPart);
this.Size = size;
}
#region FieldProperties
public GoDrawing drawingPart = null;
public Color ObjBrushColor
{
get
{
return drawingPart.BrushColor;
}
{
drawingPart.BrushColor = value;
}
}
#endregion FieldProperties
{
if (view is GoOverview) return null;
if (!(view.Document is GraphDoc)) return null;
GoContextMenu cm = new GoContextMenu(view);
if (!((GraphDoc)view.Document).IsReadOnly)
{
cm.MenuItems.Add(new MenuItem("Change Color", new EventHandler(this.ChangeColor_Command)));
}
return cm;
}
{
Random random = new Random();
int r = random.Next(0, 255);
int g = random.Next(0, 255);
int b = random.Next(0, 255);
ObjBrushColor = Color.FromArgb(r, g, b);
//drawingPart.BrushColor = Color.FromArgb(r, g, b);
Size = new SizeF(size, size);
}
}
}