blazor-devexpress-dot-blazor-dot-dxdropdown-09ad35c3.md
Specifies a template for content of the drop-down window’s body.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
[Parameter]
public RenderFragment<IPopupElementInfo> BodyContentTemplate { get; set; }
| Type | Description |
|---|---|
| RenderFragment<IPopupElementInfo> |
The body content.
|
Use the BodyContentTemplate property to display any render fragment in the drop-down body’s content area. This template does not affect the default content area rendering (that is, paddings, alignment, etc.)
The BodyContentTemplate accepts an IPopupElementInfo object as the context parameter. You can use the parameter’s CloseCallback property to implement the Close button.
<DxButton Id="showDDbutton" Click="() => IsOpen = true">Show DropDown</DxButton>
<DxDropDown @bind-IsOpen="@IsOpen"
Width="400"
HeaderVisible="true"
HeaderText="Edit Contact"
FooterVisible="true">
<BodyContentTemplate>
<SampleEditForm />
</BodyContentTemplate>
<FooterContentTemplate>
<DxButton RenderStyle="ButtonRenderStyle.Primary" Text="OK" Click="@context.CloseCallback" />
<DxButton RenderStyle="ButtonRenderStyle.Secondary" Text="Cancel" Click="@context.CloseCallback" />
</FooterContentTemplate>
</DxDropDown>
@code {
bool IsOpen { get; set; } = false;
}
<DxFormLayout Data="@editFormData" CssClass="w-100">
<DxFormLayoutItem Field="@nameof(FormDataItem.Name)" Caption="Contact Name:" CaptionPosition="CaptionPosition.Vertical" ColSpanMd="12">
<DxTextBox Text="@(((string)((ValueEditContext)context).Value))" />
</DxFormLayoutItem>
<DxFormLayoutItem Field="@nameof(FormDataItem.BirthDate)" Caption="Birth Date:" CaptionPosition="CaptionPosition.Vertical" ColSpanMd="6">
<DxDateEdit Date="@(((DateTime)((ValueEditContext)context).Value))" />
</DxFormLayoutItem>
<DxFormLayoutItem Field="@nameof(FormDataItem.YearsWorked)" Caption="Years Worked:" CaptionPosition="CaptionPosition.Vertical" ColSpanMd="6">
<DxSpinEdit Value="@(((int)((ValueEditContext)context).Value))" />
</DxFormLayoutItem>
<DxFormLayoutItem Field="@nameof(FormDataItem.Position)" Caption="Position:" CaptionPosition="CaptionPosition.Vertical" ColSpanMd="12">
<DxComboBox Data="@(new List<string>() {"Sales Representative", "Designer"})"
Value="@(((string)((ValueEditContext)context).Value))">
</DxComboBox>
</DxFormLayoutItem>
</DxFormLayout>
@code {
FormDataItem editFormData = new() { Name = "Nancy Davolio", BirthDate = DateTime.Now.AddYears(-30), YearsWorked = 3, Position = "Sales Representative" };
}
See Also