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)); }
/// <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 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); }
///<inheritdoc/> public string GetListName(System.ComponentModel.PropertyDescriptor[] listAccessors) { ITypedList tlist = list as ITypedList; if (tlist == null) { return(null); } else { return(tlist.GetListName(listAccessors)); } }
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); }
// 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); }
string ITypedList.GetListName(PropertyDescriptor[] listAccessors) { ITypedList list = this.collection as ITypedList; return(list.GetListName(listAccessors)); }
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; }
string ITypedList.GetListName(PropertyDescriptor[] listAccessors) { return(NestedTypedList.GetListName(listAccessors)); }
public string GetListName(PropertyDescriptor[] listAccessors) { return(NestedTypedList.GetListName(ExtractOriginalDescriptors(listAccessors))); }
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]); }
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; }