Example #1
0
 protected virtual void NotifyParentChange(GridEntry ge)
 {
     while (((ge != null) && (ge is PropertyDescriptorGridEntry)) && ((PropertyDescriptorGridEntry)ge).propertyInfo.Attributes.Contains(NotifyParentPropertyAttribute.Yes))
     {
         object valueOwner  = ge.GetValueOwner();
         bool   isValueType = valueOwner.GetType().IsValueType;
         while ((!(ge is PropertyDescriptorGridEntry) || isValueType) ? valueOwner.Equals(ge.GetValueOwner()) : (valueOwner == ge.GetValueOwner()))
         {
             ge = ge.ParentGridEntry;
             if (ge == null)
             {
                 break;
             }
         }
         if (ge != null)
         {
             valueOwner = ge.GetValueOwner();
             IComponentChangeService componentChangeService = this.ComponentChangeService;
             if (componentChangeService != null)
             {
                 componentChangeService.OnComponentChanging(valueOwner, ((PropertyDescriptorGridEntry)ge).propertyInfo);
                 componentChangeService.OnComponentChanged(valueOwner, ((PropertyDescriptorGridEntry)ge).propertyInfo, null, null);
             }
             ge.ClearCachedValues(false);
             PropertyGridView gridEntryHost = this.GridEntryHost;
             if (gridEntryHost != null)
             {
                 gridEntryHost.InvalidateGridEntryValue(ge);
             }
         }
     }
 }
        protected virtual void NotifyParentChange(GridEntry ge)
        {
            // now see if we need to notify the parent(s) up the chain
            while (ge != null &&
                   ge is PropertyDescriptorGridEntry &&
                   ((PropertyDescriptorGridEntry)ge).propertyInfo.Attributes.Contains(NotifyParentPropertyAttribute.Yes))
            {
                // find the next parent property with a differnet value owner
                object owner = ge.GetValueOwner();

                // Fix for Dev10 bug 584323:
                // when owner is an instance of a value type,
                // we can't just use == in the following while condition testing
                bool isValueType = owner.GetType().IsValueType;

                // find the next property descriptor with a different parent
                while (!(ge is PropertyDescriptorGridEntry) ||
                       isValueType ? owner.Equals(ge.GetValueOwner()) : owner == ge.GetValueOwner())
                {
                    ge = ge.ParentGridEntry;
                    if (ge == null)
                    {
                        break;
                    }
                }

                // fire the change on that owner
                if (ge != null)
                {
                    owner = ge.GetValueOwner();

                    IComponentChangeService changeService = ComponentChangeService;

                    if (changeService != null)
                    {
                        changeService.OnComponentChanging(owner, ((PropertyDescriptorGridEntry)ge).propertyInfo);
                        changeService.OnComponentChanged(owner, ((PropertyDescriptorGridEntry)ge).propertyInfo, null, null);
                    }

                    ge.ClearCachedValues(false); //clear the value so it paints correctly next time.
                    PropertyGridView gv = this.GridEntryHost;
                    if (gv != null)
                    {
                        gv.InvalidateGridEntryValue(ge);
                    }
                }
            }
        }
 protected virtual void NotifyParentChange(GridEntry ge)
 {
     while (((ge != null) && (ge is PropertyDescriptorGridEntry)) && ((PropertyDescriptorGridEntry) ge).propertyInfo.Attributes.Contains(NotifyParentPropertyAttribute.Yes))
     {
         object valueOwner = ge.GetValueOwner();
         bool isValueType = valueOwner.GetType().IsValueType;
         while ((!(ge is PropertyDescriptorGridEntry) || isValueType) ? valueOwner.Equals(ge.GetValueOwner()) : (valueOwner == ge.GetValueOwner()))
         {
             ge = ge.ParentGridEntry;
             if (ge == null)
             {
                 break;
             }
         }
         if (ge != null)
         {
             valueOwner = ge.GetValueOwner();
             IComponentChangeService componentChangeService = this.ComponentChangeService;
             if (componentChangeService != null)
             {
                 componentChangeService.OnComponentChanging(valueOwner, ((PropertyDescriptorGridEntry) ge).propertyInfo);
                 componentChangeService.OnComponentChanged(valueOwner, ((PropertyDescriptorGridEntry) ge).propertyInfo, null, null);
             }
             ge.ClearCachedValues(false);
             PropertyGridView gridEntryHost = this.GridEntryHost;
             if (gridEntryHost != null)
             {
                 gridEntryHost.InvalidateGridEntryValue(ge);
             }
         }
     }
 }
        protected virtual void NotifyParentChange(GridEntry ge) {
            // now see if we need to notify the parent(s) up the chain
            while (ge != null &&
                   ge is PropertyDescriptorGridEntry &&
                   ((PropertyDescriptorGridEntry)ge).propertyInfo.Attributes.Contains(NotifyParentPropertyAttribute.Yes)) {

                // find the next parent property with a differnet value owner
                object owner = ge.GetValueOwner();

                // Fix for Dev10 bug 584323:
                // when owner is an instance of a value type, 
                // we can't just use == in the following while condition testing
                bool isValueType = owner.GetType().IsValueType;

                // find the next property descriptor with a different parent
                while (!(ge is PropertyDescriptorGridEntry) 
                    || isValueType ? owner.Equals(ge.GetValueOwner()) : owner == ge.GetValueOwner()) {
                    ge = ge.ParentGridEntry;
                    if (ge == null) {
                        break;
                    }
                }

                // fire the change on that owner
                if (ge != null) {
                    owner = ge.GetValueOwner();

                    IComponentChangeService changeService = ComponentChangeService;
                    
                    if (changeService != null) {
                        changeService.OnComponentChanging(owner, ((PropertyDescriptorGridEntry)ge).propertyInfo);
                        changeService.OnComponentChanged(owner, ((PropertyDescriptorGridEntry)ge).propertyInfo, null, null);
                    }

                    ge.ClearCachedValues(false); //clear the value so it paints correctly next time.
                    PropertyGridView gv = this.GridEntryHost;
                    if (gv != null) {
                        gv.InvalidateGridEntryValue(ge);
                    }
                }
            }
        }