Class FieldDescriptor
FieldDescriptor provides mapping information to a column of the underlying datasource.
Fields are managed by the FieldDescriptorCollection that is returned by the Fields property of a TableDescriptor.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Grouping
Assembly: Syncfusion.Grouping.Base.dll
Syntax
public class FieldDescriptor : DescriptorBase, ICustomTypeDescriptor, IDisposable, ICloneable, IStandardValuesProvider
Constructors
FieldDescriptor()
Initializes a new instance for FieldDescriptor FieldDescriptor class.
Declaration
public FieldDescriptor()
FieldDescriptor(String)
Initializes a new instance for FieldDescriptor FieldDescriptor class. with a name.
Declaration
public FieldDescriptor(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Name of the field descriptor. |
FieldDescriptor(String, String, Boolean, String)
Initializes a new instance for FieldDescriptor FieldDescriptor class. with a name, mapping name, Read-only setting, and default value for NULL fields.
Declaration
public FieldDescriptor(string name, string mappingName, bool readOnly, string defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The Name for FieldDescriptor. |
| System.String | mappingName | Mapping name. |
| System.Boolean | readOnly | Indicates if the descriptor is read-only. |
| System.String | defaultValue | Default value. |
FieldDescriptor(String, Type)
Initializes a new instance for FieldDescriptor FieldDescriptor class. with a name and a type. Use this constructor only for unbound fields.
Declaration
public FieldDescriptor(string name, Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Field descriptor name. |
| System.Type | type | Type of the descriptor. |
Properties
AllowTrimEnd
Gets or sets whether the GetValue(Record) method should trim whitespace at end of text if field is a string. This is useful if databases return string with fixed character length and fill up the rest of field with blanks. (Default is True.)
Declaration
public virtual bool AllowTrimEnd { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
Collection
The collection this descriptor belongs to.
Declaration
public FieldDescriptorCollection Collection { get; }
Property Value
| Type |
|---|
| FieldDescriptorCollection |
DefaultValue
Gets of sets the default value that should be used for empty fields in the AddNewRecord.
Declaration
public string DefaultValue { get; set; }
Property Value
| Type |
|---|
| System.String |
FieldPropertyType
Gets or sets the property type.
Declaration
public Type FieldPropertyType { get; set; }
Property Value
| Type |
|---|
| System.Type |
FieldPropertyTypeString
Gets or sets Serialize helper for XML Serialization of FieldPropertyType
Declaration
public string FieldPropertyTypeString { get; set; }
Property Value
| Type |
|---|
| System.String |
ForceImmediateSaveValue
Gets or sets whether changes to the field in a record should immediately trigger a SaveValue event without first calling BeginEdit on the current record. This property is useful if you do want to have unbound fields that should not trigger ListChanged events when only the unbound property is modified on the current record.
Declaration
public virtual bool ForceImmediateSaveValue { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
Hide
Gets or sets Hide state of the field.
Declaration
public virtual bool Hide { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
IsSorting
Internal only.
Declaration
public bool IsSorting { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
MappingName
Gets or sets the mapping for this field. You should specify which field of a System.Data.DataTable or strong-typed collection you want to display in the grid at this field. The MappingName can also point to a property inside a complex object with nested properties of a collection when a '.' is specified.
Declaration
public string MappingName { get; set; }
Property Value
| Type |
|---|
| System.String |
Name
Gets or sets the name of the field.
Declaration
public virtual string Name { get; set; }
Property Value
| Type |
|---|
| System.String |
PreventUnboundFieldTypeCheck
Internal only.
Declaration
public static bool PreventUnboundFieldTypeCheck { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
ReadOnly
Gets or set Read-only state of the field.
Declaration
public virtual bool ReadOnly { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
ReferencedFields
Gets or sets ReferencedFields state of the field. Use a semicolon as delimiter when specifying multiple fields. The Engine will use these fields in the ListChanged event to determine which cells to update when a change was made in an underlying field.
Declaration
public virtual string ReferencedFields { get; set; }
Property Value
| Type |
|---|
| System.String |
TableDescriptor
Gets the TableDescriptor that this descriptor belongs to.
Declaration
public TableDescriptor TableDescriptor { get; }
Property Value
| Type |
|---|
| TableDescriptor |
Methods
Clone()
Creates a copy of this descriptor.
Declaration
public virtual FieldDescriptor Clone()
Returns
| Type | Description |
|---|---|
| FieldDescriptor | A copy of this descriptor. |
CopyAllMembersTo(FieldDescriptor)
Copies all properties to another element without raising Changing or Changed events.
Declaration
protected void CopyAllMembersTo(FieldDescriptor fd)
Parameters
| Type | Name | Description |
|---|---|---|
| FieldDescriptor | fd | The target object. |
DetermineReferencedFields()
Returns an array of field descriptor names that the expression references.
Declaration
protected virtual string DetermineReferencedFields()
Returns
| Type | Description |
|---|---|
| System.String | Returns array of field descriptor names. |
Dispose(Boolean)
Releases all resources used by the System.ComponentModel.Component.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Overrides
Remarks
See the documentation for the System.ComponentModel.Component class and its Dispose member.
Equals(Object)
Compares two field descriptors.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | Field descriptor. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the descriptors are equal; False otherwise. |
Overrides
GetComplexPropertyDescriptors()
Gets the complex property descriptor this descriptor holds. If this field descriptor is not a wrapper object for a nested property inside a complex object, the method will return NULL.
Declaration
public PropertyDescriptor[] GetComplexPropertyDescriptors()
Returns
| Type | Description |
|---|---|
| System.ComponentModel.PropertyDescriptor[] | A complex property descriptor. |
GetExpressionFieldDescriptor()
Gets the expression field descriptor this descriptor holds. If this field descriptor is not a wrapper object for a expression field, the method will return NULL.
Declaration
public ExpressionFieldDescriptor GetExpressionFieldDescriptor()
Returns
| Type | Description |
|---|---|
| ExpressionFieldDescriptor | An expression field descriptor. |
GetHashCode()
Serves as a hash function.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 | Hash code. |
Overrides
GetName()
Returns the name of the descriptor.
Declaration
public override string GetName()
Returns
| Type | Description |
|---|---|
| System.String | Field descriptor name. |
Overrides
GetNestedRelatedDescriptor()
Gets a nested related field descriptor of a related table that this descriptor holds.
Declaration
public FieldDescriptor GetNestedRelatedDescriptor()
Returns
| Type | Description |
|---|---|
| FieldDescriptor | Nested related field descriptor. |
GetParentFieldDescriptor()
Gets a related field descriptor of a related table that this descriptor holds. If this field descriptor is not a wrapper object for a field in a related table, the method will return NULL.
Declaration
public FieldDescriptor GetParentFieldDescriptor()
Returns
| Type | Description |
|---|---|
| FieldDescriptor | A field descriptor of the related table. |
GetPropertyDescriptor()
Gets the property descriptor this descriptor holds. If this field descriptor is not a wrapper object for a property in the main table (and also not a nested property inside a complex object), the method will return NULL.
Declaration
public PropertyDescriptor GetPropertyDescriptor()
Returns
| Type | Description |
|---|---|
| System.ComponentModel.PropertyDescriptor | A property descriptor. |
GetPropertyType()
Gets the result type of this field.
Declaration
public virtual Type GetPropertyType()
Returns
| Type | Description |
|---|---|
| System.Type | Property type. |
GetRelatedDescriptor()
Gets a related field descriptor of a related table that this descriptor holds. If this field descriptor is not a wrapper object for a field in a related table, the method will return NULL.
Declaration
public FieldDescriptor GetRelatedDescriptor()
Returns
| Type | Description |
|---|---|
| FieldDescriptor | A field descriptor of the related table. |
GetRelatedSummaryDescriptor()
Gets a related summary descriptor of a related table that this descriptor holds. (for RelationKind.ForeignKeyKeyWords)
Declaration
public SummaryDescriptor GetRelatedSummaryDescriptor()
Returns
| Type | Description |
|---|---|
| SummaryDescriptor | A summary descriptor of the related table. |
GetRelation()
Gets the relation descriptor this descriptor holds. If this field descriptor is not a wrapper object for a field in a related table, the method will return NULL.
Declaration
public RelationDescriptor GetRelation()
Returns
| Type | Description |
|---|---|
| RelationDescriptor | A expression field descriptor. |
GetSimplePropertyDescriptor()
Gets the property descriptor this descriptor holds. If this field descriptor is a wrapper object for a property (IsComplexPropertyField) in the main table, the method will return NULL.
Declaration
public PropertyDescriptor GetSimplePropertyDescriptor()
Returns
| Type | Description |
|---|---|
| System.ComponentModel.PropertyDescriptor | A property descriptor. |
GetUnboundFieldDescriptor()
Gets the unbound field descriptor this descriptor holds. If this field descriptor is not a wrapper object for a unbound field, the method will return NULL.
Declaration
public FieldDescriptor GetUnboundFieldDescriptor()
Returns
| Type | Description |
|---|---|
| FieldDescriptor | An expression field descriptor. |
GetValue(Record)
Retrieves the value for this field from the underlying record.
Declaration
public virtual object GetValue(Record record)
Parameters
| Type | Name | Description |
|---|---|---|
| Record | record | The record with data for this field. |
Returns
| Type | Description |
|---|---|
| System.Object | The value from the underlying record. |
GetValueFromDataRow(Object)
Retrieves the value for this field from the underlying record.
Declaration
public object GetValueFromDataRow(object data)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | data | The DataRow with data for this field. |
Returns
| Type | Description |
|---|---|
| System.Object | The value from the underlying record. |
InitializeFrom(FieldDescriptor)
Initializes this object and copies properties from another object. PropertyChanging and PropertyChanged events are raised for every property that is modified. If both objects are equal, no events are raised.
Declaration
public virtual void InitializeFrom(FieldDescriptor other)
Parameters
| Type | Name | Description |
|---|---|---|
| FieldDescriptor | other | The source object. |
IsComplexPropertyField()
Determines if this field descriptor is a wrapper object for a nested property inside a complex object. If so, the method will return NULL.
Declaration
public bool IsComplexPropertyField()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if this is a complex property field; False otherwise. |
IsDynamicPropertyField()
Determines if this field descriptor is a wrapper object for a dynamic property in the main table (and not a nested property inside a complex object).
Declaration
public bool IsDynamicPropertyField()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if it is a property field; False otherwise. |
IsExpressionField()
Determines if this field descriptor is a wrapper object for an expression field.
Declaration
public bool IsExpressionField()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if it is an expression field; False otherwise. |
IsForeignKeyField()
Determines if this field descriptor is a foreign key field (and therefore changes to the field will affect other fields in the record).
Declaration
public bool IsForeignKeyField()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if it is a foreign key field; False otherwise. |
IsObjectReferenceField()
Determines if this field descriptor is an object reference field.
Declaration
public bool IsObjectReferenceField()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if it is an object reference field; False otherwise. |
IsPropertyField()
Determines if this field descriptor is a wrapper object for a property in the main table (and not a nested property inside a complex object).
Declaration
public bool IsPropertyField()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if it is a property field; False otherwise. |
IsRelatedField()
Gets a related field descriptor of a related table that this descriptor holds. If this field descriptor is not a wrapper object for a field in a related table, the method will return NULL.
Declaration
public bool IsRelatedField()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if it is a related field; False otherwise. |
IsUnboundField()
Determines if this field descriptor is an unbound field (no mapping name to an underlying property of the underlying datasource given).
Declaration
public bool IsUnboundField()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if it is an unbound field; False otherwise. |
OnPropertyChanged(DescriptorPropertyChangedEventArgs)
Raises the PropertyChanged event.
Declaration
protected virtual void OnPropertyChanged(DescriptorPropertyChangedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| DescriptorPropertyChangedEventArgs | e | A DescriptorPropertyChangedEventArgs that contains the event data. |
OnPropertyChanging(DescriptorPropertyChangedEventArgs)
Raises the PropertyChanging event.
Declaration
protected virtual void OnPropertyChanging(DescriptorPropertyChangedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| DescriptorPropertyChangedEventArgs | e | A DescriptorPropertyChangedEventArgs that contains the event data. |
ResetAllowTrimEnd()
Resets the AllowTrimEnd property to False.
Declaration
public void ResetAllowTrimEnd()
ResetDefaultValue()
Resets the default value to empty.
Declaration
public void ResetDefaultValue()
ResetFieldPropertyType()
Resets the FieldPropertyType property.
Declaration
public void ResetFieldPropertyType()
ResetForceImmediateSaveValue()
Resets the ForceImmediateSaveValue property to False.
Declaration
public void ResetForceImmediateSaveValue()
ResetHide()
Resets the Hide property to False.
Declaration
public void ResetHide()
ResetName()
Resets the field's name.
Declaration
public void ResetName()
ResetReadOnly()
Resets the Read-only to False.
Declaration
public void ResetReadOnly()
ResetReferencedFields()
Resets the ReferencedFields property to False.
Declaration
public void ResetReferencedFields()
SetValue(Record, Object)
Saves the value into the underlying data source. If the field is an unbound field, a SaveValue event is raised.
Declaration
public void SetValue(Record record, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| Record | record | The record |
| System.Object | value | The new value. |
SetValue(Record, Object, Boolean)
Saves the value into the underlying data source. If the field is an unbound field, a SaveValue event is raised.
Declaration
public virtual void SetValue(Record record, object value, bool forceListChanged)
Parameters
| Type | Name | Description |
|---|---|---|
| Record | record | The record. |
| System.Object | value | The new value. |
| System.Boolean | forceListChanged | Specifies if a ListChanged event should be raised. |
ShouldSerializeAllowTrimEnd()
Determines if the AllowTrimEnd state of the field was modified.
Declaration
public bool ShouldSerializeAllowTrimEnd()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the state was modified; False otherwise. |
ShouldSerializeDefaultValue()
Determines whether the default value is empty.
Declaration
public bool ShouldSerializeDefaultValue()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the default value is not empty; False otherwise. |
ShouldSerializeFieldPropertyType()
Determines if the FieldPropertyType of the field was modified.
Declaration
public bool ShouldSerializeFieldPropertyType()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the content were modified; False otherwise. |
ShouldSerializeForceImmediateSaveValue()
Determines if the ForceImmediateSaveValue state of the field was modified.
Declaration
public bool ShouldSerializeForceImmediateSaveValue()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the content were modified; False otherwise. |
ShouldSerializeHide()
Determines if the Hide state of the field was modified.
Declaration
public bool ShouldSerializeHide()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the content were modified; False otherwise. |
ShouldSerializeName()
Determines if the field's name was modified.
Declaration
public bool ShouldSerializeName()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if name is modified. |
ShouldSerializeReadOnly()
Determines if the Read-only state of the field was modified.
Declaration
public bool ShouldSerializeReadOnly()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the content were modified; False otherwise. |
ShouldSerializeReferencedFields()
Determines if the ReferencedFields state of the field was modified.
Declaration
public virtual bool ShouldSerializeReferencedFields()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the content were modified; False otherwise. |
ToString()
Returns string representation of the descriptor.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | String representation of the current object. |
Overrides
Events
PropertyChanged
Occurs when a property is changed.
Declaration
public event DescriptorPropertyChangedEventHandler PropertyChanged
Event Type
| Type |
|---|
| DescriptorPropertyChangedEventHandler |
PropertyChanging
Occurs before a property is changed.
Declaration
public event DescriptorPropertyChangedEventHandler PropertyChanging
Event Type
| Type |
|---|
| DescriptorPropertyChangedEventHandler |
Explicit Interface Implementations
IStandardValuesProvider.GetStandardValues(PropertyDescriptor)
Returns an array of standard values used by StandardValuesCollectionConverter.
Declaration
ICollection IStandardValuesProvider.GetStandardValues(PropertyDescriptor pd)
Parameters
| Type | Name | Description |
|---|---|---|
| System.ComponentModel.PropertyDescriptor | pd | The context.PropertyDescriptor of a TypeConverter.GetStandardValues method. |
Returns
| Type | Description |
|---|---|
| System.Collections.ICollection | An array of standard values used by StandardValuesCollectionConverter. |
ICloneable.Clone()
Creates a copy of descriptor.
Declaration
object ICloneable.Clone()
Returns
| Type | Description |
|---|---|
| System.Object | A copy of the descriptor. |