Ejemplo n.º 1
0
        /// <summary>
        /// Attaches an additional property value to this property.
        /// </summary>
        /// <param name="key">The unique key that identifies the additional value.</param>
        /// <param name="valueType">The type of the additional value stored by the property.</param>
        /// <param name="defaultValue">The initial value of the additional property value.</param>
        /// <param name="attributes">Since the new property is created dynamically, it is possible to attach
        /// attributes not know at design-time to the property.</param>
        /// <remarks>
        /// You use AddValue to create a property that holds multiple values. This is the technique used to create
        /// a property that contains a numerical value and its unit.
        /// <para>The value can be retrieved by using <see cref="Property.GetValue"/>.</para>
        /// </remarks>
        /// <example>
        /// <code>
        /// propEnum = AppendProperty(catEnum, _id, "Frequency", this, "Frequency", "");
        /// propEnum.Property.AddValue(PropertyUnitLook.UnitValue, this, "Unit", null);
        /// propEnum.Property.Value.Look = new PropertyUnitLook();
        /// propEnum.Property.Feel = GetRegisteredFeel(PropertyGrid.FeelEditUnit);
        /// </code>
        /// </example>
        public void AddManagedValue(object key, Type valueType, object defaultValue, params Attribute[] attributes)
        {
            PropertyValue value = new PropertyValueManaged(0, valueType, defaultValue, attributes);

            value.Grid = _grid;

            _additionalValues.Add(key, value);

            value.OwnerEnumerator    = Value.OwnerEnumerator;
            value.AdditionalValueKey = key;
        }
Ejemplo n.º 2
0
        internal void SetManuallyDisabled(PropertyEnumerator propEnum, bool disabled)
        {
            _canBeDisabledManually = disabled;
            if (_canBeDisabledManually)
            {
                _enabledVariable      = new PropertyValueManaged(0, typeof(bool), _enabled, null);
                _enabledVariable.Grid = ParentGrid;
//                if (_enabled)
//                  _enabled = !ParentGrid.Grid.IsAncestorDisabled(propEnum);
            }
            else
            {
                _enabledVariable = null;
            }
        }
Ejemplo n.º 3
0
        internal void SetManuallyDisabled(PropertyEnumerator propEnum, bool disabled)
        {
            _canBeDisabledManually = disabled;
            if (_canBeDisabledManually)
            {
                _enabledVariable = new PropertyValueManaged(0, typeof(bool), _enabled, null);
                _enabledVariable.Grid = ParentGrid;
//                if (_enabled)
  //                  _enabled = !ParentGrid.Grid.IsAncestorDisabled(propEnum);
            }
            else
                _enabledVariable = null;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Attaches an additional property value to this property.
        /// </summary>
        /// <param name="key">The unique key that identifies the additional value.</param>
        /// <param name="valueType">The type of the additional value stored by the property.</param>
        /// <param name="defaultValue">The initial value of the additional property value.</param>
        /// <param name="attributes">Since the new property is created dynamically, it is possible to attach
        /// attributes not know at design-time to the property.</param>
        /// <remarks>
        /// You use AddValue to create a property that holds multiple values. This is the technique used to create
        /// a property that contains a numerical value and its unit.
        /// <para>The value can be retrieved by using <see cref="Property.GetValue"/>.</para>
        /// </remarks>
        /// <example>
        /// <code>
        /// propEnum = AppendProperty(catEnum, _id, "Frequency", this, "Frequency", "");
        /// propEnum.Property.AddValue(PropertyUnitLook.UnitValue, this, "Unit", null);
        /// propEnum.Property.Value.Look = new PropertyUnitLook();
        /// propEnum.Property.Feel = GetRegisteredFeel(PropertyGrid.FeelEditUnit);
        /// </code>
        /// </example>
        public void AddManagedValue(object key, Type valueType, object defaultValue, params Attribute[] attributes)
        {
            PropertyValue value = new PropertyValueManaged(0, valueType, defaultValue, attributes);
            value.Grid = _grid;

            _additionalValues.Add(key, value);

            value.OwnerEnumerator = Value.OwnerEnumerator;
            value.AdditionalValueKey = key;
        }
Ejemplo n.º 5
0
 public ManagedPropertyDescriptor(PropertyValueManaged propertyValue, Attribute[] attributes)
     : base("internal", attributes)
 {
     _propertyValue = propertyValue;
 }
Ejemplo n.º 6
0
 public ManagedPropertyDescriptor(PropertyValueManaged propertyValue, Attribute[] attributes)
     : base("internal", attributes)
 {
     _propertyValue = propertyValue;
 }