Bewerken

Delen via


IPersistComponentSettings.SettingsKey Property

Definition

Gets or sets the value of the application settings key for the current instance of the control.

public:
 property System::String ^ SettingsKey { System::String ^ get(); void set(System::String ^ value); };
public string SettingsKey { get; set; }
member this.SettingsKey : string with get, set
Public Property SettingsKey As String

Property Value

A String containing the settings key for the current instance of the control.

Remarks

Use the SettingsKey property to disambiguate groups of application settings properties when there are multiple instances of the same wrapper class. For example, if a control contains an associated wrapper class, then placing multiple instances of the same control in the same application will typically result in multiple instances of the wrapper class. A settings key is required only when the configuration data differs on a per-instance basis; for example, the location of dynamically positioned controls.

The following general rules apply to the use of SettingsKey:

  • A control, like any class, may contain zero or more application settings classes, derived from ApplicationSettingsBase. Each settings class contains its own ApplicationSettingsBase.SettingsKey property, which helps disambiguate multiple instances of that class.

  • A control should separate its per-instance data and its shared data into different settings classes.

  • For a control with any per-instance configuration data, the get accessor of the SettingsKey property should default to the Name of the control. In most cases the name of the control will be unique within an application. If the control contains only shared configuration data, get should default to null.

  • The set accessor for this property should be implemented to distinguish between settings classes containing per-instance and shared configuration data. For each settings class containing per-instance data, set should just pass-through to the ApplicationSettingsBase.SettingsKey property of the settings class. For settings classes containing shared data, set should perform no action for that settings class.

Applies to

See also