@*   Xafari Framework version : 17.2.3011.1336   *@

@using DevExpress.ExpressApp.Layout

@model Xafari.Mvc.Layout.LayoutItemContainer

@{
	// SetCssClass
	var css = "Item";
	if (this.Model.Model is DevExpress.ExpressApp.Web.SystemModule.IModelViewLayoutElementWeb)
	{
		css = css + " " + ((DevExpress.ExpressApp.Web.SystemModule.IModelViewLayoutElementWeb)this.Model.Model).CustomCSSClassName;

	}
	//
	//SetConstraints
	var style = string.Empty;
	if (this.Model.Model.SizeConstraintsType == XafSizeConstraintsType.Custom)
	{
		var getConstraintStyle = new Func<string, int, string>((s, i) => i != 0 ? string.Format("{0}: {1}px;", s, i) : string.Empty);
		style += getConstraintStyle("min-width", this.Model.Model.MinSize.Width);
		style += getConstraintStyle("min-height", this.Model.Model.MinSize.Height);
		style += getConstraintStyle("max-width", this.Model.Model.MaxSize.Width);
		style += getConstraintStyle("max-height", this.Model.Model.MaxSize.Height);
	}
	//
	//SetConstraints
	if ((this.Model.Model.SizeConstraintsType == XafSizeConstraintsType.Custom) && (this.Model.ViewItem is DevExpress.ExpressApp.Web.Layout.ISupportSizeConstraints))
	{
		((DevExpress.ExpressApp.Web.Layout.ISupportSizeConstraints)this.Model.ViewItem).ApplyConstraints(this.Model.Model.MinSize, this.Model.Model.MaxSize);
	}
	//

	if (!this.Model.ShowCaption && this.Model.ViewItem != null && this.Model.ViewItem.Control != null)
	{
		css = css + " " + this.Model.GetParentControlCssClass(this.Model.ViewItem);
	}
}
<div class="@(css)" style="@(style)">
	@if (this.Model.ShowCaption)
	{
		<table cellspacing="0" cellpadding="1" border="0" width="100%">
			@switch (this.Model.CaptionLocation)
			{
				case Locations.Default:
				case Locations.Left:
					{
						<tr>
							@Html.Xafari().RelativePartial("_CaptionCell")
							@Html.Xafari().RelativePartial("_ControlCell")
						</tr>
						break;
					}

				case Locations.Right:
					{
						<tr>
							@Html.Xafari().RelativePartial("_ControlCell")
							@Html.Xafari().RelativePartial("_CaptionCell")
						</tr>
						break;
					}

				case Locations.Top:
					{
						<tr>
							@Html.Xafari().RelativePartial("_CaptionCell")
						</tr>
						<tr>
							@Html.Xafari().RelativePartial("_ControlCell")
						</tr>
						break;
					}

				case Locations.Bottom:
					{
						<tr>
							@Html.Xafari().RelativePartial("_ControlCell")
						</tr>
						<tr>
							@Html.Xafari().RelativePartial("_CaptionCell")
						</tr>
						break;
					}
			}
		</table>
	}
	else
	{
		@Html.Xafari().RelativePartial("_ViewItemControl")
	}
</div>

