Properties and layout
Generic objects have two data structures:
- Properties
- Layout
Properties
The generic object properties define what should be calculated. The properties data structure is exposed using properties on every generic object.
Example: Setting properties for a table
myTable.Properties.Title = "My Table Title"; myTable.Properties.Footnote = "My Table Footnote";
Layout
The generic object layout contains all the calculated values. It is exposed directly on the generic object.
Example: An example of a table layout
string myTableTitle = myTable.Title; string myTableFootnote = myTable.Footnote;
Properties and layout in shared session environment
When working with generic objects in a shared session environment, changes in one client propagate to all other clients as well. This invalidates all objects and triggers automatic fetching of the properties and layout the next time they are being accessed.
To synchronize this with your code, you can delay a possible invalidation until after you have made your changes to the generic object. There are two ways to do this:
- Explicitly suspending and resuming layout
- With a using block
Example: Explicitly suspending and resuming layout
myTable.SuspendLayout(); myTable.Properties.Title = "My Table Title"; myTable.Properties.Footnote = "My Table Footnote"; myTable.ResumeLayout();
Example: With a using block (preferred solution)
using (myTable.SuspendedLayout) { myTable.Properties.Title = "My Table Title"; myTable.Properties.Footnote = "My Table Footnote"; }