当前位置: 首页>>代码示例>>C#>>正文


C# PropertyDescriptor.AddValueChanged方法代码示例

本文整理汇总了C#中System.ComponentModel.PropertyDescriptor.AddValueChanged方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyDescriptor.AddValueChanged方法的具体用法?C# PropertyDescriptor.AddValueChanged怎么用?C# PropertyDescriptor.AddValueChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ComponentModel.PropertyDescriptor的用法示例。


在下文中一共展示了PropertyDescriptor.AddValueChanged方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EventMonitor

 private EventMonitor(object instance, PropertyDescriptor property)
 {
     property.AddValueChanged(instance, (sender, e) =>
     {
         count++;
     });
 }
开发者ID:distantcam,项目名称:ModelFuu,代码行数:7,代码来源:EventMonitor.cs

示例2: Initialize

		/// <summary>
		/// This function asigns a source and property to this viewmodel.
		/// </summary>
		/// <param name="source">The source.</param>
		/// <param name="property">The Property.</param>
		public virtual void Initialize(object source, PropertyDescriptor property)
		{
			Source = source;
			Property = property;
			Property.AddValueChanged(source, delegate
			{
				OnValueChanged();
			});
		}
开发者ID:Kha,项目名称:YUV.KA,代码行数:14,代码来源:PropertyViewModel.cs

示例3: Arrange

        protected override void Arrange()
        {
            base.Arrange();

            traceOutputOptions = TraceListener.Property("TraceOutputOptions");
            componentModelTraceOutputOptions = TraceListenerTypeDescriptor.GetProperties().OfType<PropertyDescriptor>().Where(x => x.Name == "TraceOutputOptions").First();

            expirationPollFrequencyChanged = false;

            componentModelTraceOutputOptions.AddValueChanged(TraceListenerTypeDescriptor, new EventHandler((sender, args) => expirationPollFrequencyChanged = true));
        }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:11,代码来源:when_editing_property.cs

示例4: Arrange

        protected override void Arrange()
        {
            base.Arrange();

            expirationPollFrequency = CacheManager.Property("ExpirationPollFrequencyInSeconds");
            componentModelExpirationPollFrequency = CacheManagerTypeDescriptor.GetProperties().OfType<PropertyDescriptor>().Where(x => x.Name == "ExpirationPollFrequencyInSeconds").First();

            expirationPollFrequencyChanged = false;

            componentModelExpirationPollFrequency.AddValueChanged(CacheManagerTypeDescriptor, new EventHandler((sender, args) => expirationPollFrequencyChanged = true));
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:11,代码来源:when_editing_property.cs

示例5: Property

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="instance"></param>
        /// <param name="descriptor"></param>
        /// <param name="owner"></param>
        public Property(object instance, PropertyDescriptor descriptor, PropertyEditor owner)
            : base(owner)
        {
            Instance = instance;
            Descriptor = descriptor;

            Name = descriptor.Name;
            Header = descriptor.DisplayName;
            ToolTip = descriptor.Description;

            // todo: is this ok? could it be a weak event?
            Descriptor.AddValueChanged(Instance, InstancePropertyChanged);
        }
开发者ID:betology,项目名称:SambaPOS-3,代码行数:19,代码来源:Property.cs

示例6: SetDataSource

        internal override void SetDataSource(Object dataSource) {
            if (this.dataSource != null && !String.IsNullOrEmpty(this.propName)) {
                propInfo.RemoveValueChanged(this.dataSource, new EventHandler(PropertyChanged));
                propInfo = null;
            }

            this.dataSource = dataSource;

            if (this.dataSource != null && !String.IsNullOrEmpty(this.propName)) {
                propInfo = TypeDescriptor.GetProperties(dataSource).Find(propName, true);
                if (propInfo == null)
                    throw new ArgumentException(SR.GetString(SR.PropertyManagerPropDoesNotExist, propName, dataSource.ToString()));
                propInfo.AddValueChanged(dataSource, new EventHandler(PropertyChanged));
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:15,代码来源:PropertyManager.cs

示例7: PropertyItem

        /// <summary>
        /// Initializes a new instance of the <see cref="PropertyItem"/> class.
        /// </summary>
        public PropertyItem(PropertyDescriptor property, object instance)
        {
            Property = property;
            Instance = instance;

            ResetCommand = new Command<object>(ResetValue, CanResetValue);
            EditBindingCommand = new Command<object>(ShowBindingEditor, o => !property.IsReadOnly);
            EditResourceCommand = new Command<object>(ShowResourceEditor, o => !property.IsReadOnly);

            _propertySortInfo = PropertySorter.GetSortInfo(property);
            _markupObject = MarkupWriter.GetMarkupObjectFor(Instance);

            property.AddValueChanged(instance, OnValueChanged);

            _dpd = DependencyPropertyDescriptor.FromProperty(property);
        }
开发者ID:bdurrani,项目名称:WPF-Inspector,代码行数:19,代码来源:PropertyItem.cs

示例8: ComponentChangeDispatcher

 public ComponentChangeDispatcher(IServiceProvider serviceProvider, object component, PropertyDescriptor propertyDescriptor)
 {
     this.serviceProvider = serviceProvider;
     this.component = component;
     this.property = propertyDescriptor;
     IComponentChangeService service = serviceProvider.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
     if (service != null)
     {
         try
         {
             this.newValue = this.oldValue = propertyDescriptor.GetValue(component);
             propertyDescriptor.AddValueChanged(component, new EventHandler(this.OnValueChanged));
             service.OnComponentChanging(component, propertyDescriptor);
         }
         catch (CheckoutException exception)
         {
             if (exception != CheckoutException.Canceled)
             {
                 throw exception;
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:ComponentChangeDispatcher.cs

示例9: ValueChangedRecord

            /// <summary>
            /// Constructor</summary>
            /// <param name="manager">The value changed event manager</param>
            /// <param name="source">The source of the value changed event</param>
            /// <param name="pd">The property descriptor of the value that changed</param>
            public ValueChangedRecord(ValueChangedEventManager manager, object source, PropertyDescriptor pd)
            {
                // keep a strong reference to the source.  Normally we avoid this, but
                // it's OK here since its scope is exactly the same as the strong reference
                // held by the PD:  begins with pd.AddValueChanged, ends with
                // pd.RemoveValueChanged.   This ensures that we _can_ call RemoveValueChanged
                // even in cases where the source implements value-semantics (which
                // confuses the PD - see 795205).
                m_manager = manager;
                m_source = new WeakReference(source);
                m_pd = pd;
                m_eventArgs = new ValueChangedEventArgs(pd);

                pd.AddValueChanged(source, new EventHandler(OnValueChanged));
            }
开发者ID:Joxx0r,项目名称:ATF,代码行数:20,代码来源:ValueChangedEventManager.cs

示例10: ComponentChangeDispatcher

        public ComponentChangeDispatcher(IServiceProvider serviceProvider, object component, PropertyDescriptor propertyDescriptor)
        {
            this.serviceProvider = serviceProvider;
            this.component = component;
            this.property = propertyDescriptor;

            IComponentChangeService changeService = serviceProvider.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
            if (changeService != null)
            {
                try
                {
                    newValue = oldValue = propertyDescriptor.GetValue(component);
                    propertyDescriptor.AddValueChanged(component, new EventHandler(OnValueChanged));
                    changeService.OnComponentChanging(component, propertyDescriptor);
                }
                catch (CheckoutException coEx)
                {
                    if (coEx == CheckoutException.Canceled)
                        return;
                    throw coEx;
                }
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:23,代码来源:BasePropertyDescriptor.cs

示例11: SubscribeValueChanged

        /// <summary>
        /// Subscribes to the ValueChanged event.
        /// </summary>
        /// <param name="descriptor">
        /// The descriptor.
        /// </param>
        /// <param name="handler">
        /// The handler.
        /// </param>
        protected void SubscribeValueChanged(PropertyDescriptor descriptor, EventHandler handler)
        {
            if (this.IsEnumerable)
            {
                var list = this.Instance as IEnumerable;
                if (list == null)
                {
                    throw new InvalidOperationException("Instance should be a list.");
                }

                foreach (var item in list)
                {
                    descriptor.AddValueChanged(this.GetPropertyOwner(descriptor, item), handler);
                }
            }
            else
            {
                descriptor.AddValueChanged(this.GetPropertyOwner(descriptor, this.Instance), handler);
            }
        }
开发者ID:betology,项目名称:SambaPOS-3,代码行数:29,代码来源:PropertyViewModel.cs

示例12: CheckBinding

        internal void CheckBinding() {

            // At design time, don't check anything.
            //
            if (owner != null &&
                owner.BindableComponent != null &&
                owner.ControlAtDesignTime()) {

                return;
            }

            // force Column to throw if it's currently a bad column.
            //DataColumn tempColumn = this.Column;

            // remove propertyChangedNotification when this binding is deleted
            if (this.owner.BindingManagerBase != null &&
                this.fieldInfo != null &&
                this.owner.BindingManagerBase.IsBinding &&
                !(this.owner.BindingManagerBase is CurrencyManager)) {

                fieldInfo.RemoveValueChanged(owner.BindingManagerBase.Current, new EventHandler(PropValueChanged));
            }

            if (owner != null &&
                owner.BindingManagerBase != null &&
                owner.BindableComponent != null &&
                owner.ComponentCreated && 
                this.IsDataSourceInitialized) {

                string dataField = dataMember.BindingField;

                fieldInfo = owner.BindingManagerBase.GetItemProperties().Find(dataField, true);
                if (owner.BindingManagerBase.DataSource != null && fieldInfo == null && dataField.Length > 0) {
                    throw new ArgumentException(SR.GetString(SR.ListBindingBindField, dataField), "dataMember");
                }

                // Do not add propertyChange notification if
                // the fieldInfo is null                
                //
                // we add an event handler to the dataSource in the BindingManagerBase because
                // if the binding is of the form (Control, ControlProperty, DataSource, Property1.Property2.Property3)
                // then we want to get notification from Current.Property1.Property2 and not from DataSource
                // when we get the backEnd notification we push the new value into the Control's property
                //
                if (fieldInfo != null &&
                    owner.BindingManagerBase.IsBinding &&
                    !(this.owner.BindingManagerBase is CurrencyManager)) {

                    fieldInfo.AddValueChanged(this.owner.BindingManagerBase.Current, new EventHandler(PropValueChanged));
                }
            }
            else {
                fieldInfo = null;
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:55,代码来源:BindToObject.cs


注:本文中的System.ComponentModel.PropertyDescriptor.AddValueChanged方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。