63 lines
1.6 KiB
C#
63 lines
1.6 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using System.Drawing.Design;
|
|
using System.Linq;
|
|
using System.Xml;
|
|
|
|
namespace JD.Winforms.XmlGrid
|
|
{
|
|
[TypeConverter(typeof(ExpandableObjectConverter))]
|
|
class ContainerVar : ContainerCollectionClass
|
|
{
|
|
private ContainerVar()
|
|
{
|
|
}
|
|
|
|
public static ContainerVar ParseXml( XmlNode Node, IObjectNodeInterface Parent )
|
|
{
|
|
ContainerVar ret = new ContainerVar();
|
|
|
|
ret.SetParent(Parent);
|
|
ret.name = Node.Attributes["strTAG"].Value;
|
|
|
|
return ret;
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
List.Clear();
|
|
name = "";
|
|
}
|
|
}
|
|
|
|
public class ContainerEditor : System.Drawing.Design.UITypeEditor
|
|
{
|
|
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
|
|
{
|
|
if (context != null && context.Instance != null)
|
|
{
|
|
if (!context.PropertyDescriptor.IsReadOnly)
|
|
{
|
|
return UITypeEditorEditStyle.Modal;
|
|
}
|
|
}
|
|
return UITypeEditorEditStyle.None;
|
|
}
|
|
|
|
[RefreshProperties(RefreshProperties.All)]
|
|
public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
|
|
{
|
|
if (context == null || provider == null || context.Instance == null)
|
|
{
|
|
return base.EditValue(provider, value);
|
|
}
|
|
|
|
ContainerVar container = (ContainerVar)value;
|
|
|
|
container.CreateObject(container.Name);
|
|
|
|
return container;
|
|
}
|
|
}
|
|
|
|
}
|