PreferencePropertyT Class

Spotfire 14.2 API Reference
One or more preference properties constitute a preference implemented as a type extending PreferenceBase. Each preference property is identified by a name and the Category and SubCategory of the preference that it is contained in.

The value of a preference property is decided through inheritance, where user values always have precedence before group values, that is, a user can override that value of a property inherited from a group. The same way, a group can override the value of a parent group. In addition, the preference property may have a default values which is returned when neither parent group(s) nor the user has defined a value for the property.

Each property is also associated with a version number. This version number must always be increased if the property is changed from the prior version such that the new version cannot be interpreted by older version through the default behavior of the .Net serialization framework. For instance, if the type T is changed from String to Int32, the version number should be increased. The version number should also be increased if properties are added to or removed from T.

Inheritance Hierarchy

SystemObject
  DedicatedThreadAccessible
    Spotfire.Dxp.Framework.PreferencesPreferencePropertyBase
      Spotfire.Dxp.Framework.PreferencesPreferencePropertyT

Namespace:  Spotfire.Dxp.Framework.Preferences
Assembly:  Spotfire.Dxp.Framework (in Spotfire.Dxp.Framework.dll) Version: 64.0.19329.3263 (64.0.19329.3263)
Syntax

C#
public sealed class PreferenceProperty<T> : PreferencePropertyBase

Type Parameters

T
The value type of this property. Note that it is highly recommended for this type to be immutable, that is, it should not be possible to make changes to the internal state of object of the type. If the type is not immutable, internal changes in object must be manually reported to the framework through calls to OnValueChanged.

Since the property is persisted using serialization, it is required of type T to be serializable. If T is a custom type, it must have a PersistenceVersion attribute.

The PreferencePropertyT type exposes the following members.

Constructors

  NameDescription
Public methodPreferencePropertyT(String, String, PreferencePersistenceScope, PreferenceUsage)
Initializes a new instance of type PreferencePropertyT.
Public methodPreferencePropertyT(String, String, PreferencePersistenceScope, PreferenceUsage, PreferencePropertyTDefaultValueCalculatorCallback)
Initializes a new instance of type PreferencePropertyT.
Public methodPreferencePropertyT(String, String, PreferencePersistenceScope, PreferenceUsage, T)
Initializes a new instance of type PreferencePropertyT.
Public methodPreferencePropertyT(String, String, PreferencePersistenceScope, PreferenceUsage, T, T)
Initializes a new instance of type PreferencePropertyT.
Public methodPreferencePropertyT(String, String, PreferencePersistenceScope, PreferenceUsage, PreferencePropertyTDefaultValueCalculatorCallback, T, T)
Initializes a new instance of type PreferencePropertyT.
Public methodPreferencePropertyT(String, String, PreferencePersistenceScope, PreferenceUsage, T, T, T)
Initializes a new instance of type PreferencePropertyT.
Top
Properties

  NameDescription
Public propertyName
Gets the name of this property.
(Inherited from PreferencePropertyBase.)
Public propertyUsage
Gets the usage of the property.
(Inherited from PreferencePropertyBase.)
Public propertyValue
Gets or sets the value of the property. A get request to this property will return the overridden value of a preference property. That is, if the user has overridden the value inherited from the user group, that inherited value is returned. Otherwise, the group value is returned. The same way, group values may override the values inherited from parent groups. If no value can be found, neither at the group level nor at the user level, a default value is returned. The default value is passed to the constructors of this class, either as a value or a PreferencePropertyTDefaultValueCalculatorCallback. If no default value exists, null is returned for reference types, and 0 is returned for value types.

Setting the property will only affect the user level value and override the inherited group value (if such exists).

After setting or resetting the value of a preference property, Save() must be called on the owning preference to cause the property to be persisted.

Public propertyValueType
Gets the type of the value of this property.
(Inherited from PreferencePropertyBase.)
Top
Methods

  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodOnValueChanged
Use this method to report changes that may have occurred inside of an mutable property value. The Save must be used to persist the changes.
Public methodReset
Resets any value that may explicitly have been given to this property on a user level basis through a call to Value. The effect of resetting a property is that when the Value of it is queried, either the group value or the default value will be returned.
(Inherited from PreferencePropertyBase.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodUndoChanges
Undoes any changes that may have been to the value of this property since it was last saved.
(Inherited from PreferencePropertyBase.)
Top
Version Information

Supported in: 14.2, 14.1, 14.0, 12.5, 12.4, 12.3, 12.2, 12.1, 12.0, 11.8, 11.7, 11.6, 11.5, 11.4
See Also

Reference