如果選擇對齊方式:水平,烏節將呈現的項目,就像你描述;彼此相鄰。
如果您只選擇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
你可以給烏節文件鏈接嗎? –