API Reference: InlineAttribute Class
The InlineAttribute
can be applied to content model properties. The attribute specifies that in the back office application, the property field should be displayed inline (i.e. in the same row) with other property fields, as opposed to below each other.
If you want to have multiple separate rows of inline properties on the same content model class, pass a fieldset name to the attribute to group different inline fields together by name.
This attribute is only for layout purposes and does not change any other behavior of the property.
Usage
Decorate the content model class with the InlineAttribute
. Optionally pass a fieldset name in the attribute constructor, if you have multiple rows of inline fields on the same class. If you do not specify a fieldset name, the property will be grouped together with all other inline properties without a fieldset name.
All properties that have the same fieldset name will be displayed inline in the back office application. You can optionally set the Width
attribute to specify a width for each inline field.
Example
The following example demonstrates how to layout content in two columns.
public class TwoColumns: IContentType
{
[Inline("heading")]
[Width("50%")]
public string HeadingLeft { get; set; }
[Inline("heading")]
[Width("50%")]
public string HeadingRight { get; set; }
[Inline("body")]
[Width("50%")]
public HtmlString BodyLeft { get; set; }
[Inline("body")]
[Width("50%")]
public HtmlString BodyRight { get; set; }
}