DxFormLayoutItem.CaptionTemplate Property
Specifies the template used to display the item’s caption.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public RenderFragment CaptionTemplate { get; set; }
Property Value
Type | Description |
---|---|
RenderFragment | The template content. |
Remarks
Use the CaptionTemplate
property to implement custom content for the item’s caption. The following code snippet adds Open Iconic icons to item captions:
<style>
.caption{
padding: 4px
}
</style>
<DxFormLayout CssClass="w-100" CaptionPosition="CaptionPosition.Vertical">
<DxFormLayoutItem>
<CaptionTemplate>
<div class="caption">
<span class="oi oi-person" />
Contact Name:
</div>
</CaptionTemplate>
<Template>
<DxTextBox @bind-Text="@Name" />
</Template>
</DxFormLayoutItem>
<DxFormLayoutItem>
<CaptionTemplate>
<div class ="caption">
<span class="oi oi-book" />
Email:
</div>
</CaptionTemplate>
<Template>
<DxTextBox @bind-Text="@Email" />
</Template>
</DxFormLayoutItem>
<DxFormLayoutItem>
<CaptionTemplate>
<div class="caption">
<span class="oi oi-calendar" />
Birth Date:
</div>
</CaptionTemplate>
<Template>
<DxDateEdit @bind-Date="@BirthDate" Mask="@DateTimeMask.ShortDate" />
</Template>
</DxFormLayoutItem>
<DxFormLayoutItem>
<CaptionTemplate>
<div class="caption">
<span class="oi oi-bell" />
On Vacation:
</div>
</CaptionTemplate>
<Template>
<DxCheckBox @bind-Checked="@OnVacation" />
</Template>
</DxFormLayoutItem>
</DxFormLayout>
@code {
string Name { get; set; } = "Nancy Davolio";
string Email { get; set; } = "NancyDavolio@sample.com";
DateTime BirthDate { get; set; } = DateTime.Now.AddYears(-20);
int YearsWorked { get; set; } = 3;
bool OnVacation { get; set; } = true;
}
See Also