public static PropertyDescriptorCollection GetSourceProperties(object list) { ITypedList typedList = list as ITypedList; if (typedList != null) { return(typedList.GetItemProperties(null)); } IList l = list as IList; if (l != null && l.Count > 0) { return(GetItemProperties(l[0])); } IEnumerable enumerable = list as IEnumerable; if (enumerable != null) { IEnumerator enumerator = enumerable.GetEnumerator(); if (enumerator.MoveNext()) { return(GetItemProperties(enumerator.Current)); } } return(null); }
/// <include file='doc\DesignTimeData.uex' path='docs/doc[@for="DesignTimeData.GetDataMembers"]/*' /> /// <devdoc> /// </devdoc> public static string[] GetDataMembers(object dataSource) { IListSource listSource = dataSource as IListSource; if ((listSource != null) && listSource.ContainsListCollection) { IList memberList = ((IListSource)dataSource).GetList(); Debug.Assert(memberList != null, "Got back null from IListSource"); ITypedList typedList = memberList as ITypedList; if (typedList != null) { PropertyDescriptorCollection props = typedList.GetItemProperties(new PropertyDescriptor[0]); if (props != null) { ArrayList members = new ArrayList(props.Count); foreach (PropertyDescriptor pd in props) { members.Add(pd.Name); } return((string[])members.ToArray(typeof(string))); } } } return(null); }
PropertyDescriptorCollection ITypedList.GetItemProperties(PropertyDescriptor[] listAccessors) { ITypedList tList = fDataSource as ITypedList; PropertyDescriptorCollection properties; if (tList == null) { if (fDataSource.Count == 0 || listAccessors != null) { properties = new PropertyDescriptorCollection(new PropertyDescriptor[0]); } else { properties = TypeDescriptor.GetProperties(fDataSource[0]); } } else { properties = ((ITypedList)fDataSource).GetItemProperties(listAccessors); } List <PropertyDescriptor> result = new List <PropertyDescriptor>(); foreach (PropertyDescriptor property in properties) { result.Add(new ReadOnlyPropertyDescriptor(property)); } return(new PropertyDescriptorCollection(result.ToArray())); }
public MyDataSourceWrapper(ITypedList dataSource, string unboundColumnFieldName, GetValueEventHanlder getValueHandler, SetValueEventHanlder setValueHanlder) { this.NestedList = (IList)dataSource; descriptor = new MyPropertyDescriptor(unboundColumnFieldName); descriptor.GetUnboundValue += getValueHandler; descriptor.SetUnboundValue += setValueHanlder; }
public MyDataSourceWrapper(ITypedList list, MyObject nullObject, string valueMember, string displayMember) { _ValueMember = valueMember; _DisplayMember = displayMember; _NullObject = nullObject; this.NestedList = (IList)list; }
public static string GetListName(object list, PropertyDescriptor[] listAccessors) { System.Type propertyType; if (list == null) { return(string.Empty); } ITypedList list2 = list as ITypedList; if (list2 != null) { return(list2.GetListName(listAccessors)); } if ((listAccessors == null) || (listAccessors.Length == 0)) { System.Type type2 = list as System.Type; if (type2 != null) { propertyType = type2; } else { propertyType = list.GetType(); } } else { PropertyDescriptor descriptor = listAccessors[0]; propertyType = descriptor.PropertyType; } return(GetListNameFromType(propertyType)); }
PropertyDescriptorCollection ITypedList.GetItemProperties(PropertyDescriptor[] listAccessors) { PropertyDescriptorCollection props = null; ITypedList srcTypedList = dataSource as ITypedList; if (srcTypedList != null) { props = srcTypedList.GetItemProperties(listAccessors); } if (dataSource.Count > 0) { props = TypeDescriptor.GetProperties(dataSource[0]); } if (props == null) { return(null); } List <PropertyDescriptor> res = new List <PropertyDescriptor>(); switch (rtype) { case ReportType.Report1: res.Add(props["A"]); break; case ReportType.Report2: res.Add(props["B"]); break; } return(new PropertyDescriptorCollection(res.ToArray())); }
public PropertyDescriptorCollection GetProperties() { IList list = DataSource as IList; if (list == null) { if (DataSource is IListSource) { list = ((IListSource)DataSource).GetList(); } } if (list == null) { return(new PropertyDescriptorCollection(new PropertyDescriptor[0], true)); } ITypedList typedList = list as ITypedList; if (typedList == null) { if (list.Count > 0) { return(TypeDescriptor.GetProperties(list[0])); } } else { return(typedList.GetItemProperties(new PropertyDescriptor[0])); } return(new PropertyDescriptorCollection(new PropertyDescriptor[0], true)); }
/// <include file='doc\ListBindingHelper.uex' path='docs/doc[@for="ListBindingHelper.GetListName"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public static string GetListName(object list, PropertyDescriptor[] listAccessors) { string name; if (list == null) { return string.Empty; } ITypedList typedList = list as ITypedList; if (typedList != null) { // Use typed list name = typedList.GetListName(listAccessors); } else { Type type; // We always resolve via type in this case (not an instance) if ((null == listAccessors) || (listAccessors.Length == 0)) { Type listAsType = list as Type; if (listAsType != null) { type = listAsType; } else { type = list.GetType(); } } else { // We don't walk down - always use type name PropertyDescriptor pd = listAccessors[0]; type = pd.PropertyType; } name = GetListNameFromType(type); } return name; }
private bool InitBindableControls(Control control) { foreach (Binding binding in control.DataBindings) { BizEntity item = binding.BindingManagerBase.Current as BizEntity; if (item != null) { string key = GetBindingKey(item, binding, control); if (_keyToControl.ContainsKey(key)) { continue; } string[] str = null; PropertyDescriptor pd = null; ITypedList typedList = binding.DataSource as ITypedList; if (typedList != null) { pd = typedList.GetItemProperties(null).Find( binding.BindingMemberInfo.BindingField, false); if (pd != null) { str = Validator.GetErrorMessages(item, pd); } } if (str == null) { str = item.GetErrorMessages(binding.BindingMemberInfo.BindingField); } if (str.Length > 0) { Array.Sort(str); } ControlInfo ci = new ControlInfo(control, str.Length > 0, pd); _bindableControls.Add(ci); _keyToControl.Add(key, ci); if (ci.IsValidatable) { _toolTip.SetToolTip(control, string.Join("\r\n", str)); } control.LostFocus += ValidateControl; control.Validated += ValidateControl; control.EnabledChanged += ValidateControl; } } return(true); }
private void button2_Click(object sender, EventArgs e) { ITypedList tList = (ITypedList)((IListSource)dataGrid1.DataSource).GetList(); IBindingList bList = (IBindingList)tList; int index = bList.Find(tList.GetItemProperties(null)[0], "Stephen"); dataGrid1.Rows[index].Selected = true; }
public PropertyDescriptorCollection GetItemProperties(PropertyDescriptor [] listAccessors) { ITypedList typed = source as ITypedList; if (typed == null) { return(null); } return(typed.GetItemProperties(listAccessors)); }
public static IEnumerable ResolveDataSource(object o, string data_member) { IEnumerable ds; ds = o as IEnumerable; if (ds != null) { return(ds); } IListSource ls = o as IListSource; if (ls == null) { return(null); } IList member_list = ls.GetList(); if (!ls.ContainsListCollection) { return(member_list); } ITypedList tl = member_list as ITypedList; if (tl == null) { return(null); } PropertyDescriptorCollection pd = tl.GetItemProperties(new PropertyDescriptor[0]); if (pd == null || pd.Count == 0) { throw new HttpException("The selected data source did not contain any data members to bind to"); } PropertyDescriptor member_desc = data_member == "" ? pd[0] : pd.Find(data_member, true); if (member_desc != null) { ds = member_desc.GetValue(member_list[0]) as IEnumerable; } if (ds == null) { throw new HttpException("A list corresponding to the selected DataMember was not found"); } return(ds); }
private DataGridTableStyle GetCurrentTableStyle() { if (ListManager == null) { return(null); } ITypedList typedList = ListManager.List as ITypedList; string listName = (typedList == null ? ListManager.List.GetType().Name : typedList.GetListName(null)); return(TableStyles[listName]); }
PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties() { if (DataView == null) { ITypedList typedList = (ITypedList)_dataView; return(typedList.GetItemProperties(new PropertyDescriptor[0])); } else { return(DataView.Table.GetPropertyDescriptorCollection()); } }
private PropertyDescriptor GetPropertyDescriptorFromITypedList(ITypedList iTypedList) { if (string.IsNullOrEmpty(this.RelationName) == true) { return(null); } Type objectType = null; ICustomTypeDescriptor customTypeDescriptor = null; PropertyDescriptorCollection properties = null; PropertyDescriptor relationDescriptor = null; TypeDescriptionProvider typeDescriptionProvider = null; if (iTypedList != null) { properties = iTypedList.GetItemProperties(null); if ((properties != null) && (properties.Count > 0)) { relationDescriptor = properties[this.RelationName]; } else { string listName = iTypedList.GetListName(null); if (string.IsNullOrEmpty(listName) == false) { objectType = Type.GetType(listName, false, false); if (objectType != null) { typeDescriptionProvider = TypeDescriptor.GetProvider(objectType); if (typeDescriptionProvider != null) { customTypeDescriptor = typeDescriptionProvider.GetTypeDescriptor(objectType); if (customTypeDescriptor != null) { properties = customTypeDescriptor.GetProperties(); if ((properties != null) && (properties.Count > 0)) { relationDescriptor = properties[this.RelationName]; } } } } } } } return(relationDescriptor); }
/// <summary> /// 포커스가 가 있는 그리드의 정보를 데이터 테이블로 변환한다. /// </summary> /// <param name="pGrid">그리드.</param> /// <returns>리턴값</returns> public static DataTable GetPivotFocusedCellInfo(PivotGridControl pGrid, DataReturnType type) { try { DataTable table = new DataTable(); if (type == DataReturnType.FocusedCell) { PivotSummaryDataSource dataSource = pGrid.Cells.GetFocusedCellInfo().CreateSummaryDataSource() as PivotSummaryDataSource; ITypedList list = dataSource as ITypedList; foreach (PropertyDescriptor property in list.GetItemProperties(null)) { table.Columns.Add(property.Name, property.PropertyType); } for (int rowIndex = 0; rowIndex < dataSource.RowCount; rowIndex++) { object[] values = new object[table.Columns.Count]; for (int columnIndex = 0; columnIndex < table.Columns.Count; columnIndex++) { values[columnIndex] = dataSource.GetValue(rowIndex, /*rowIndex*/ columnIndex); } table.Rows.Add(values); } } else if (type == DataReturnType.All) { PivotSummaryDataSource dataSourceAll = pGrid.CreateSummaryDataSource() as PivotSummaryDataSource; ITypedList listAll = dataSourceAll as ITypedList; foreach (PropertyDescriptor property in listAll.GetItemProperties(null)) { table.Columns.Add(property.Name, property.PropertyType); } for (int rowIndex = 0; rowIndex < dataSourceAll.RowCount; rowIndex++) { object[] values = new object[table.Columns.Count]; for (int columnIndex = 0; columnIndex < table.Columns.Count; columnIndex++) { values[columnIndex] = dataSourceAll.GetValue(rowIndex, /*rowIndex*/ columnIndex); } table.Rows.Add(values); } } return(table); } catch (Exception ex) { throw ex; } }
///<inheritdoc/> public System.ComponentModel.PropertyDescriptorCollection GetItemProperties(System.ComponentModel.PropertyDescriptor[] listAccessors) { ITypedList tlist = list as ITypedList; if (tlist == null) { return(null); } else { return(tlist.GetItemProperties(listAccessors)); } }
///<inheritdoc/> public string GetListName(System.ComponentModel.PropertyDescriptor[] listAccessors) { ITypedList tlist = list as ITypedList; if (tlist == null) { return(null); } else { return(tlist.GetListName(listAccessors)); } }
public MyGridLookupDataSourceHelper(GridLookUpEdit edit, ITypedList dataSource, string displayMember, string valueMember) { this.edit = edit; _MyObject.ID = Int32.MinValue + 5; _DataSourceWrapper = new MyDataSourceWrapper(dataSource, _MyObject, valueMember, displayMember); edit.Properties.DisplayMember = displayMember; edit.Properties.ValueMember = valueMember; edit.Properties.DataSource = _DataSourceWrapper; edit.Properties.View.CustomRowFilter += View_CustomRowFilter; edit.ProcessNewValue += edit_ProcessNewValue; edit.Properties.View.RefreshData(); edit.Properties.QueryPopUp += new CancelEventHandler(Properties_QueryPopUp); }
private PropertyDescriptor GetPropertyDescriptorFromITypedList(ITypedList typedList) { if (string.IsNullOrEmpty(this.RelationName) || (typedList == null)) { return(null); } PropertyDescriptorCollection properties; properties = typedList.GetItemProperties(null); if ((properties != null) && (properties.Count > 0)) { return(properties[this.RelationName]); } var listName = typedList.GetListName(null); if (string.IsNullOrEmpty(listName)) { return(null); } var itemType = Type.GetType(listName, false, false); if (itemType == null) { return(null); } var descriptionProvider = TypeDescriptor.GetProvider(itemType); if (descriptionProvider == null) { return(null); } var descriptor = descriptionProvider.GetTypeDescriptor(itemType); if (descriptor == null) { return(null); } properties = descriptor.GetProperties(); if ((properties != null) && (properties.Count > 0)) { return(properties[this.RelationName]); } return(null); }
/// <include file='doc\DesignTimeData.uex' path='docs/doc[@for="DesignTimeData.GetDataMember"]/*' /> /// <devdoc> /// </devdoc> public static IEnumerable GetDataMember(IListSource dataSource, string dataMember) { IEnumerable list = null; IList memberList = dataSource.GetList(); if ((memberList != null) && (memberList is ITypedList)) { if (dataSource.ContainsListCollection == false) { Debug.Assert((dataMember == null) || (dataMember.Length == 0), "List does not contain data members"); if ((dataMember != null) && (dataMember.Length != 0)) { throw new ArgumentException(); } list = (IEnumerable)memberList; } else { ITypedList typedMemberList = (ITypedList)memberList; PropertyDescriptorCollection propDescs = typedMemberList.GetItemProperties(new PropertyDescriptor[0]); if ((propDescs != null) && (propDescs.Count != 0)) { PropertyDescriptor listProperty = null; if ((dataMember == null) || (dataMember.Length == 0)) { listProperty = propDescs[0]; } else { listProperty = propDescs.Find(dataMember, true); } if (listProperty != null) { object listRow = memberList[0]; object listObject = listProperty.GetValue(listRow); if ((listObject != null) && (listObject is IEnumerable)) { list = (IEnumerable)listObject; } } } } } return(list); }
private static PropertyDescriptorCollection GetListItemPropertiesByEnumerable(IEnumerable enumerable, PropertyDescriptor[] listAccessors) { if ((listAccessors == null) || (listAccessors.Length == 0)) { return(GetListItemPropertiesByEnumerable(enumerable)); } ITypedList list = enumerable as ITypedList; if (list != null) { return(list.GetItemProperties(listAccessors)); } return(GetListItemPropertiesByEnumerable(enumerable, listAccessors, 0)); }
/// <summary> /// The following code was obtained by using Reflector(tm). /// It tries to transform any object into something IEnumerable /// </summary> /// <param name="dataSource"></param> /// <param name="dataMember"></param> /// <returns></returns> internal static IEnumerable GetResolvedDataSource(object dataSource, string dataMember) { if (dataSource == null) { return(null); } IListSource source1 = dataSource as IListSource; if (source1 != null) { IList list1 = source1.GetList(); if (!source1.ContainsListCollection) { return(list1); } if ((list1 != null) && (list1 is ITypedList)) { ITypedList list2 = (ITypedList)list1; PropertyDescriptorCollection collection1 = list2.GetItemProperties(new PropertyDescriptor[0]); if ((collection1 == null) || (collection1.Count == 0)) { throw new HttpException("ListSource_Without_DataMembers"); } PropertyDescriptor descriptor1 = null; if ((dataMember == null) || (dataMember.Length == 0)) { descriptor1 = collection1[0]; } else { descriptor1 = collection1.Find(dataMember, true); } if (descriptor1 != null) { object obj1 = list1[0]; object obj2 = descriptor1.GetValue(obj1); if ((obj2 != null) && (obj2 is IEnumerable)) { return((IEnumerable)obj2); } } throw new HttpException("ListSource_Missing_DataMember"); } } if (dataSource is IEnumerable) { return((IEnumerable)dataSource); } return(null); }
public static int Find(this BindingSource source, params Key[] keys) { PropertyDescriptor[] properties = new PropertyDescriptor[keys.Length]; ITypedList typedList = source as ITypedList; if (source.Count <= 0) { return(-1); } PropertyDescriptorCollection props; if (typedList != null) // obtain the PropertyDescriptors from the list { props = typedList.GetItemProperties(null); } else // use the TypeDescriptor on the first element of the list { props = TypeDescriptor.GetProperties(source[0]); } for (int i = 0; i < keys.Length; i++) { properties[i] = props.Find(keys[i].PropertyName, true); // will throw if the property isn't found } for (int i = 0; i < source.Count; i++) { object row = source[i]; bool match = true; for (int p = 0; p < keys.Length; p++) { if (properties[p].GetValue(row) != keys[p].Value) { match = false; break; } } if (match) { return(i); } } return(-1); }
/// <summary> /// Transforms the given dictionary. /// </summary> /// <param name="data"></param> /// <returns></returns> private DataTable Transform(ITypedList data) { if (data == null) { throw new ArgumentNullException("data"); } if (!(data is IEnumerable)) { throw new ArgumentException(string.Format("data is of type '{0}', not IEnumerable.", data.GetType())); } // define a table... DataTable table = this.CreateDataTable(); // get the props... PropertyDescriptorCollection properties = data.GetItemProperties(new PropertyDescriptor[] {}); if (properties == null) { throw new InvalidOperationException("properties is null."); } // create columns... foreach (PropertyDescriptor property in properties) { // create... DataColumn column = new DataColumn(property.Name, property.PropertyType); table.Columns.Add(column); } // do the rows... object[] values = new object[properties.Count]; foreach (object obj in (IEnumerable)data) { // get the values... for (int index = 0; index < properties.Count; index++) { // get a value... object value = properties[index].GetValue(obj); values[index] = value; } // add... table.Rows.Add(values); } // return... return(table); }
private IEnumerable GetResolvedDataSource() { if (this.DataSource == null) { return(null); } if (this.DataSource is IListSource) { IListSource iListSource = (IListSource)this.DataSource; IList iList = iListSource.GetList(); if (!iListSource.ContainsListCollection) { return(iList); } if (iList != null && iList is ITypedList) { ITypedList iTypeList = ((ITypedList)iList); PropertyDescriptorCollection collection = iTypeList.GetItemProperties(new PropertyDescriptor[0]); if ((collection != null) && (collection.Count != 0)) { PropertyDescriptor discriptor = null; if ((this.DataMember == null) || (this.DataMember.Length == 0)) { discriptor = collection[0]; } else { discriptor = collection.Find(this.DataMember, true); } if (discriptor != null) { object key = iList[0]; object val = discriptor.GetValue(key); if ((val != null) && val is IEnumerable) { return((IEnumerable)val); } } throw new HttpException("The datasource does not contain a member named " + this.DataMember); } throw new HttpException("Datasource does not contain any members."); } } if (this.DataSource is IEnumerable) { return((IEnumerable)this.DataSource); } return(null); }
public static string[] GetColumnNames(ITypedList typedList) { var props = typedList.GetItemProperties(null); var columnList = new List <string>(props.Count); for (var i = 0; i < props.Count; i++) { if (props[i].PropertyType == typeof(IBindingList)) { continue; } columnList.Add(props[i].Name); } return(columnList.ToArray()); }
// customize grid display to show selected columns, captions, formats, and data maps private void _flex_SetupColumns(object sender, System.EventArgs e) { // get grid that was just bound C1FlexDataTree grid = sender as C1FlexDataTree; if (grid == null) { return; } // get data source name ITypedList itl = grid.DataSource as ITypedList; if (itl == null) { return; } string tableName = itl.GetListName(null); // look up table in data set // (the table has formatting information in its ExtendedProperties) DataTable dt = _ds.Tables[tableName]; // apply custom column order, captions, format string[] columns = dt.ExtendedProperties["ShowColumns"] as string[]; if (columns != null) { SetupColumns(grid, columns); } // apply custom data maps foreach (Column gridColumn in grid.Cols) { DataColumn dataColumn = dt.Columns[gridColumn.Name]; if (dataColumn == null) { continue; } gridColumn.DataMap = dataColumn.ExtendedProperties["DataMap"] as IDictionary; if (gridColumn.DataMap != null) { gridColumn.TextAlign = TextAlignEnum.LeftCenter; } } // all done, auto size to show mapped data grid.AutoSizeCols(1, grid.Cols.Count - 1, 12); }
public PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[] listAccessors) { ITypedList list = (ITypedList)dv; PropertyDescriptorCollection pdc = ((ITypedList)dv).GetItemProperties(listAccessors); CustomPropertyDescriptor[] pds = new CustomPropertyDescriptor[pdc.Count]; int i = 0; foreach (PropertyDescriptor pd in pdc) { pds[i++] = new CustomPropertyDescriptor(pd); } return(new PropertyDescriptorCollection(pds)); }
private PropertyDescriptor GetPropertyDescriptorFromITypedList( ITypedList iTypedList ) { if( string.IsNullOrEmpty( this.RelationName ) == true ) return null; Type objectType = null; ICustomTypeDescriptor customTypeDescriptor = null; PropertyDescriptorCollection properties = null; PropertyDescriptor relationDescriptor = null; TypeDescriptionProvider typeDescriptionProvider = null; if( iTypedList != null ) { properties = iTypedList.GetItemProperties( null ); if( ( properties != null ) && ( properties.Count > 0 ) ) { relationDescriptor = properties[ this.RelationName ]; } else { string listName = iTypedList.GetListName( null ); if( string.IsNullOrEmpty( listName ) == false ) { objectType = Type.GetType( listName, false, false ); if( objectType != null ) { typeDescriptionProvider = TypeDescriptor.GetProvider( objectType ); if( typeDescriptionProvider != null ) { customTypeDescriptor = typeDescriptionProvider.GetTypeDescriptor( objectType ); if( customTypeDescriptor != null ) { properties = customTypeDescriptor.GetProperties(); if( ( properties != null ) && ( properties.Count > 0 ) ) relationDescriptor = properties[ this.RelationName ]; } } } } } } return relationDescriptor; }
public DataSourceWithEmptyItem(ITypedList list) { this.NestedList = (IList)list; }
private void _lbxDataTable_SelectedIndexChanged(object sender, System.EventArgs e) { ITypedList itl = objectList[_lbxDataTable.SelectedIndex] as ITypedList; this.TypedList = itl; PropertyDescriptorCollection pdc = itl.GetItemProperties(null); _lvPropertyList.Items.Clear(); foreach ( PropertyDescriptor pd in pdc ) { string[] strings = new string[2]; strings[0] = pd.Name; strings[1] = pd.PropertyType.Name; ListViewItem lvItem = new ListViewItem(strings); _lvPropertyList.Items.Add(lvItem); } }
private static PropertyDescriptor GetDescriptor(ITypedList bindingListView, string propName) { var descriptorCollection = bindingListView.GetItemProperties(new PropertyDescriptor[0]); return descriptorCollection.Find(propName, true); }
internal EntityDataSourceViewSchema(ITypedList typedList) { PropertyDescriptorCollection properties = typedList.GetItemProperties(null); CreateColumnsFromPropDescs(properties, null); }
public NHServerModeSourceAdderRemover(Object serverModeSource, NHObjectSpace objectSpace, Type objectType) { this.serverModeSource = serverModeSource; this.objectSpace = objectSpace; this.objectType = objectType; listServer = serverModeSource as IListServer; listServerHints = serverModeSource as IListServerHints; bindingList = serverModeSource as IBindingList; typedList = serverModeSource as ITypedList; dxCloneable = serverModeSource as IDXCloneable; addedObjects = new List<Object>(); addedObjectsDictionary = new Dictionary<Object, Byte>(); removedObjectsDictionary = new Dictionary<Object, Byte>(); bindingList.ListChanged += new ListChangedEventHandler(bindingList_ListChanged); ITypeInfo typeInfo = objectSpace.TypesInfo.FindTypeInfo(objectType); propertyDescriptorCollection = new XafPropertyDescriptorCollection(typeInfo); foreach (IMemberInfo memberInfo in NHObjectSpace.GetDefaultDisplayableMembers(typeInfo)) { propertyDescriptorCollection.CreatePropertyDescriptor(memberInfo, memberInfo.Name); } }
private PropertyDescriptor GetPropertyDescriptorFromITypedList( ITypedList typedList ) { if( string.IsNullOrEmpty( this.RelationName ) || ( typedList == null ) ) return null; PropertyDescriptorCollection properties; properties = typedList.GetItemProperties( null ); if( ( properties != null ) && ( properties.Count > 0 ) ) return properties[ this.RelationName ]; var listName = typedList.GetListName( null ); if( string.IsNullOrEmpty( listName ) ) return null; var itemType = Type.GetType( listName, false, false ); if( itemType == null ) return null; var descriptionProvider = TypeDescriptor.GetProvider( itemType ); if( descriptionProvider == null ) return null; var descriptor = descriptionProvider.GetTypeDescriptor( itemType ); if( descriptor == null ) return null; properties = descriptor.GetProperties(); if( ( properties != null ) && ( properties.Count > 0 ) ) return properties[ this.RelationName ]; return null; }