The
Property Bag is a persistent
UserControl object containing the values of your control's custom, extender, and
delegated properties. In fact, the
Property Bag is so persistent that it
doesn't get destroyed with the instances of the
UserControl.
This means you can store property values in the
Property Bag just
before an instance of the
UserControl is destroyed and then retrieve
the stored values when a new instance of the
UserControl "wakes up" in
another part of the development life cycle.
The Property Bag has two methods to store and retrieve
values respectively:
The WriteProperty method
The ReadProperty method
You must know how to manipulate the Property Bag in
the following situations that we discuss in the sections immediately following this one:
-
You store property values into the PropertyBag by
calling its WriteProperty method in the WriteProperties
event procedure.
-
You retrieve property values from the PropertyBag by
calling its ReadProperty method in the ReadProperties
event procedure.
-
You ensure that the WriteProperties event will fire
by calling the PropertyChanged method. You'll usually
do this in the Property Let procedures of your custom
properties or at other appropriate places in your code where the storage value
of a property changes.