Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBindingHelper.cs
Log:
2008-03-17 Carlos Alberto Cortez <calbert...@gmail.com>
* ListBindingHelper.cs: Implement a pair of GetListItemProperties
method overloads.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog 2008-03-18 01:56:59 UTC (rev 98515)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog 2008-03-18 05:21:42 UTC (rev 98516)
@@ -1,3 +1,8 @@
+2008-03-17 Carlos Alberto Cortez <calbert...@gmail.com>
+
+ * ListBindingHelper.cs: Implement a pair of GetListItemProperties
+ method overloads.
+
2008-03-16 Jonathan Pobst <mon...@jpobst.com>
* ComboBox.cs: Move resetting the selected index to keypress
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBindingHelper.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBindingHelper.cs 2008-03-18 01:56:59 UTC (rev 98515)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBindingHelper.cs 2008-03-18 05:21:42 UTC (rev 98516)
@@ -92,6 +92,35 @@
return dataSource.GetType ();
}
+ public static PropertyDescriptorCollection GetListItemProperties (object list)
+ {
+ Type item_type = GetListItemType (list);
+ return TypeDescriptor.GetProperties (item_type);
+ }
+
+ public static PropertyDescriptorCollection GetListItemProperties (object dataSource, PropertyDescriptor [] listAccessors)
+ {
+ if (dataSource == null || listAccessors.Length == 0)
+ return GetListItemProperties (dataSource);
+
+ // Take into account only the first property
+ Type property_type = listAccessors [0].PropertyType;
+ if (typeof (IList).IsAssignableFrom (property_type) ||
+ typeof (IList<>).IsAssignableFrom (property_type)) {
+
+ PropertyInfo property = GetPropertyByReflection (property_type, "Item");
+ return TypeDescriptor.GetProperties (property.PropertyType);
+ }
+
+ return new PropertyDescriptorCollection (new PropertyDescriptor [0]);
+ }
+
+ public static PropertyDescriptorCollection GetListItemProperties (object dataSource, string dataMember,
+ PropertyDescriptor [] listAccessors)
+ {
+ throw new NotImplementedException ();
+ }
+
static PropertyDescriptor GetProperty (Type type, string property_name)
{
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties (type);