如果选择对齐方式:水平,乌节将呈现的项目,就像你描述;彼此相邻。
如果您只选择Alignment:vertical,Orchard将呈现堆叠的项目,其中的列是项目的属性。
当你看Orchard.Projections /供应商/设计/ GridLayout.cs的代码,你可以看到下面的代码:
public dynamic RenderLayout(LayoutContext context, IEnumerable<LayoutComponentResult> layoutComponentResults) {
bool horizontal = Convert.ToString(context.State.Alignment) != "vertical";
//..
return Shape.Grid(Id: gridId, Horizontal: horizontal, Columns: columns, Items: shapes, Tag: gridTag, Classes: new[] { gridClass }, RowTag: rowTag, RowClasses: new[] { rowClass }, CellTag: cellTag, CellClasses: new[] { cellClass }, EmptyCell: emptyCell);
}
这意味着乌节将呈现一个名为“网格”状,水平属性设置为Alignment != "vertical"
。
怎么看这个网格状实际呈现,你可以去Orchard.Projections /供应商/设计/ LayoutShapes.cs,看看下面的代码:
[Shape]
public void Grid(dynamic Display, TextWriter Output, HtmlHelper Html, string Id, bool Horizontal, IEnumerable<dynamic> Items, int Columns, string Tag, IEnumerable<string> Classes, IDictionary<string, string> Attributes, string RowTag, IEnumerable<string> RowClasses, IDictionary<string, string> RowAttributes, string CellTag, IEnumerable<string> CellClasses, IDictionary<string, string> CellAttributes, string EmptyCell) {
//..
// Here Orchard decides the columns and rows:
if (!Horizontal) {
seekItem = (row, col) => col*Columns + row;
maxCols = maxRows;
maxRows = Columns;
}
//..
}
可以使小提琴?或者提供一些代码 –
好吧,我正在使用Orchard作为Web项目,我无法自定义代码。 – user3340627
你可以给乌节文件链接吗? –