Skip to main content
A newer version of this page is available. .

DxDropDown.RestrictionMode Property

Specifies an element that restricts the DropDown position.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v22.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public DropDownRestrictionMode RestrictionMode { get; set; }

Property Value

Type Description
DropDownRestrictionMode

A restriction mode.

Available values:

Name Description
Viewport

The drop-down window position is restricted by the viewport.

Page

The drop-down window position is restricted by the page.

Rectangle

The drop-down window position is restricted by a rectangle’s boundaries (RestrictionRectangle).

TargetElement

The drop-down window position is restricted by a target element’s boundaries (RestrictionTarget).

Remarks

The DropDown changes its position when certain page elements are changed (for instance, when the page is scrolled or resized). Use the RestrictionMode property to restrict the DropDown movement.

Run Demo: DropDown - Flipping

<OptionsContent>
    <OptionComboBox Label="Close mode:" CssClass="ow-100" Data="@CloseModeSource" @bind-Value="@CloseMode"/>
    <OptionCheckBox Label="Fit to container" @bind-Checked="FitToRestriction"/>
</OptionsContent>
<ChildContent>
    <div class="@(IsMobile ? "" : "card") flipping-overflow-container">
        <dxbl-demo-scrollable center-horizontally center-vertically id="flipping-target-container" class="flipping-overflow-content">
            <DxButton
                CssClass="flipping-button" Click="() => IsOpen = !IsOpen"
                RenderStyle="@ButtonRenderStyle.Secondary">SHOW A DROPDOWN</DxButton>
        </dxbl-demo-scrollable>
        <DxDropDown
            @bind-IsOpen="@IsOpen"
            CloseOnOutsideClick="false"
            PositionMode="DropDownPositionMode.Bottom"
            PositionTarget=".flipping-button"
            RestrictionTarget=".flipping-overflow-container"
            RestrictionMode="DropDownRestrictionMode.TargetElement"
            PreventCloseOnPositionTargetClick="true"
            CloseMode="@CloseMode"
            FitToRestriction="@FitToRestriction"
            Width="240">
            <span style="font-size: 0.75rem">@Constants.ContentShort</span>
        </DxDropDown>
    </div>
</ChildContent>

@code {
@* ... *@
    bool IsOpen { get; set; } = false;
    bool IsMobile { get; set; }
    bool FitToRestriction { get; set; } = true;
    DropDownCloseMode[] CloseModeSource { get; } = Enum.GetValues<DropDownCloseMode>();
    DropDownCloseMode CloseMode { get; set; } = DropDownCloseMode.Hide;
    @* ... *@
}
See Also