Attached PropertiesAttached Properties are a WPF concept. They may be appended to Framework Elements where they are supported and appropriate. For instance, in the case of a Grid parent control, you may want to append the Grid.ColumnSpanProperty or Grid.RowSpanProperty onto one or all of its children.
In WPF-CPS, this may be accomplished via
BeginSettings . . . EndSettings via the
SetAttachedProperty method, like so, which below will set the column span property to 2 on any children that are Labels:
.SetAttachedProperty<Label, Grid>("ColumnSpan",
myLabel => { myLabel.SetValue(Grid.ColumnSpanProperty, 2); })
The setting is stored as an Action<T> to be applied when
BeginComposite . . . EndComposite gets called. You may set an attached property to be applied via Type or via Type at row-column. For instance, here is an example where a Z-Index Property is set on the child of a Canvas at a specific row-column position:
chain.SetAttachedProperty<K, T>("ZIndexProperty", row, column,
obj => { obj.SetValue(Canvas.ZIndexProperty, zIndex); });
FYI, the propertyOnK parameter (1st parameter) should likely be unique and I believe it is only used in this case to comprise a part of the dictionary unique key. The Action<T> is stored internally via a dictionary key made up of the Type Name concatenated with propertyOnK parameter concatenated with underscore plus row plus underscore plus col. In the example above, propertyOnK is "ZIndexProperty".