Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
4636 | May 22,2003 07:15 AM UTC | Jun 27,2005 10:59 AM UTC | General Discussion | 4 |
![]() |
Tags: General Discussion |
public class GridColumnDescriptor : ...
{
GridColumnDescriptorCollection collection;
///
/// Occurs when a property is changed.
///
public event DescriptorPropertyChangedEventHandler PropertyChanged;
///
/// Occurs before a property is changed.
///
public event DescriptorPropertyChangedEventHandler PropertyChanging;
///
/// Raises the event.
///
/// A that contains the event data.
protected virtual void OnPropertyChanged(DescriptorPropertyChangedEventArgs e)
{
if (this.Disposing)
return;
if (PropertyChanged != null)
PropertyChanged(this, e);
if (collection != null)
collection.RaisePropertyItemChanged(this, e);
}
///
/// Raises the event.
///
/// A that contains the event data.
protected virtual void OnPropertyChanging(DescriptorPropertyChangedEventArgs e)
{
if (this.Disposing)
return;
if (PropertyChanging != null)
PropertyChanging(this, e);
if (collection != null)
collection.RaisePropertyItemChanging(this, e);
}
[RefreshProperties(RefreshProperties.All), NotifyParentProperty(true)]
public int MaxLength
{
get
{
return maxLength;
}
set
{
if (MaxLength != value)
{
OnPropertyChanging(new DescriptorPropertyChangedEventArgs("MaxLength"));
maxLength = value;
OnPropertyChanged(new DescriptorPropertyChangedEventArgs("MaxLength"));
}
else
maxLength = value;
}
}
///
/// Determines whether has been modified
/// and should be serialized at design-time.
///
/// true if contents were changed; false otherwise.
public bool ShouldSerializeMaxLength()
{
return maxLength != -1;
}
///
/// Discards any changes for .
///
public void ResetMaxLength()
{
MaxLength = -1;
}
internal void SetCollection(GridColumnDescriptorCollection collection)
{
this.collection = collection;
this.tableDescriptor = collection._tableDescriptor;
}
The "collection" field is initialized when the column is added to a GridColumnDescriptorCollection, e.g.
///
/// Adds an object to the end of the collection.
///
/// The element to be added to the end of the collection. The value must not be a NULL reference (Nothing in Visual Basic).
/// The zero-based collection index at which the value has been added.
public int Add(GridColumnDescriptor value)
{
...
OnChanging(new ListPropertyChangedEventArgs(ListPropertyChangedType.Add, -1, value, null));
index = _inner.Add(value);
value.index = index;
value.SetCollection(this);
OnChanged(new ListPropertyChangedEventArgs(ListPropertyChangedType.Add, index, value, null));
return index;
}
Stefan
>Hi,
>
>I have added a couple of properties to my inherited GGC. These properties store collections within themselves essentially.
>
>At run-time the user can load the control and change the properties using a property-descriptor form.
>
>The GridColumnCollection class inherits: ArrayList, IInsideCollectionEditorProperty
>
>The GridColumnCollection includes GridColumn class which inherits: DescriptorBase, IStandardValuesProvider
>
>Now, the issue is, on change of these properties, the control''s properties are not being set.
>
>How do I trigger an event on the control informing the collection value has changed?
>
>Thanks and Regards,
>Ranjit This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.