r98516 - trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms

0 views
Skip to first unread message

Carlos Alberto Cortes (calberto.cortez@gmail.com)

unread,
Mar 18, 2008, 1:21:44 AM3/18/08
to mono-p...@lists.ximian.com, ximian....@gmail.com, mono-svn-patche...@googlegroups.com
Author: calberto
Date: 2008-03-18 00:21:42 -0500 (Tue, 18 Mar 2008)
New Revision: 98516

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);

Reply all
Reply to author
Forward
0 new messages