G
Guest
form code
-----------
ArrayList cList = new ArrayList();
ArrayList aList;
alist= new ArrayList();
aList.Add("Joe");
aList.Add("Smith");
aList.Add("xxx-xxx-xxxx");
cList.Add(alist);
alist= new ArrayList();
aList.Add("Dan");
aList.Add("Tan");
aList.Add("xxx-xxx-xxxx");
cList.Add(alist);
MyGridList cGridList = new MyGridList("Test", cList);
DataGrid.DataSource = cGridList;
Class Code
-----------
public class MyGridList : VirtualList, IList, ITypedList
{
public MyGridList(string pListName, ArrayList pList): base(pListName,
pList)
{
}
public PropertyDescriptorCollection
GetItemProperties(PropertyDescriptor[] listAccessors)
{
ArrayList iPdsList = new ArrayList();
return new
PropertyDescriptorCollection(iPdsList.ToArray(typeof(PropertyDescriptor)) as
PropertyDescriptor[]);
}
}
public class MylList
{
protected string iListName = "";
protected ArrayList iValueList;
public MyList(string pListName, ArrayList pValueList)
{
iListName = pListName;
iValueList = pValueList;
}
public int IndexOf(object value)
{
return 0;
}
public string GetListName(PropertyDescriptor[] listAccessors)
{
return iListName;
}
public object SyncRoot
{
get
{
return null;
}
}
public void Clear()
{
}
public bool Contains(object value)
{
return false;
}
public bool IsFixedSize
{
get
{
return true;
}
}
public void Insert(int index, object value)
{
iValueList.Insert(index, value);
}
public void Remove(object value)
{
}
public int Add(object value)
{
return 0;
}
public bool IsSynchronized
{
get
{
return false;
}
}
public int Count
{
get
{
return this.iValueList.Count;
}
}
public void RemoveAt(int index)
{
iValueList.RemoveAt(index);
}
public object this[int index]
{
get
{
if (index >= this.iValueList.Count) return null;
return this.iValueList[index];
}
set
{
}
}
public IEnumerator GetEnumerator()
{
return this.iValueList.GetEnumerator();
}
public void CopyTo(Array array, int index)
{
}
public bool IsReadOnly
{
get { return true; }
}
}
-----------
ArrayList cList = new ArrayList();
ArrayList aList;
alist= new ArrayList();
aList.Add("Joe");
aList.Add("Smith");
aList.Add("xxx-xxx-xxxx");
cList.Add(alist);
alist= new ArrayList();
aList.Add("Dan");
aList.Add("Tan");
aList.Add("xxx-xxx-xxxx");
cList.Add(alist);
MyGridList cGridList = new MyGridList("Test", cList);
DataGrid.DataSource = cGridList;
Class Code
-----------
public class MyGridList : VirtualList, IList, ITypedList
{
public MyGridList(string pListName, ArrayList pList): base(pListName,
pList)
{
}
public PropertyDescriptorCollection
GetItemProperties(PropertyDescriptor[] listAccessors)
{
ArrayList iPdsList = new ArrayList();
return new
PropertyDescriptorCollection(iPdsList.ToArray(typeof(PropertyDescriptor)) as
PropertyDescriptor[]);
}
}
public class MylList
{
protected string iListName = "";
protected ArrayList iValueList;
public MyList(string pListName, ArrayList pValueList)
{
iListName = pListName;
iValueList = pValueList;
}
public int IndexOf(object value)
{
return 0;
}
public string GetListName(PropertyDescriptor[] listAccessors)
{
return iListName;
}
public object SyncRoot
{
get
{
return null;
}
}
public void Clear()
{
}
public bool Contains(object value)
{
return false;
}
public bool IsFixedSize
{
get
{
return true;
}
}
public void Insert(int index, object value)
{
iValueList.Insert(index, value);
}
public void Remove(object value)
{
}
public int Add(object value)
{
return 0;
}
public bool IsSynchronized
{
get
{
return false;
}
}
public int Count
{
get
{
return this.iValueList.Count;
}
}
public void RemoveAt(int index)
{
iValueList.RemoveAt(index);
}
public object this[int index]
{
get
{
if (index >= this.iValueList.Count) return null;
return this.iValueList[index];
}
set
{
}
}
public IEnumerator GetEnumerator()
{
return this.iValueList.GetEnumerator();
}
public void CopyTo(Array array, int index)
{
}
public bool IsReadOnly
{
get { return true; }
}
}