Interfaces

Project

Pages Html

NuGet packageOwin.Framework.Pages.Html
GitHub sourceOwinFramework.Pages.Html

Home |  Readme

[Repeat] attribute | The OWIN Framework Pages

The [Repeat] Attribute

The [Repeat] attribute can only be used with a Region element. It instructs the region to repeat its content for each object in a list of objects. If the content tree inside the region binds to the object type that is repeated, then it will bind to the properties of a different object in the list on each iteration.

The [Repeat()] attribute has the following properties you can set.

RepeatType

Specifies the type of data that should be repeated within the Region. Setting this property implies that the region needs IList<T> data, and this does not have to be explicitly defined using the [NeedsData()] attribute

You will need to write a Data Provider that can provide IList<T> data for this to work.

RepeatScope

Provides additional constraints on the RepeatType property by specifying that the Data Provider will be asked to provide IList<T> data in this scope.

ListScope

As the Region repeats its content for each T in the IList<T> that it depends on, it will insert the object of type T into the rendering context so that each time the region is repeated it binds to a different instance of T and renders different content just as you would expect.

The ListScope property specifies the scope name to use when setting values of type T into the render context before rendering the contents of the region.

This is a fairly advanced use case that alows you to for example render two different instances of the same type within the region where one of them is the repeated data and the other was added to the render context higher up the element tree.

ChildTag

Defines an Html container element to wrap around each instance of the region's content. For example you might want to render the region with each repetition of the region's content contained in a li element.

ChildClassNames

Setting this property adds a class attribute to the container that is rendered around each child element.

You can include multiple class names separated by spaces.

If you are using CSS prefixes for package namespaces (recommended) then you can add the appropriate package namespace prefix to your class names by using the special {ns}_ marker in front of each class name that you want to be prefixed.

ChildStyle

This property contains the style definition to attach to each child container.