DropDownItem
in namespace DotVVM.Bootstrap5.Controls
Represent a child element in dropdown
Usage & Scenarios
Represents a single item inside a dropdown menu.
Sample 1: Basic Usage
This child control is shared across all DropDown controls:
All properties of DropDownItem
control could be binded with a Item
prefix property (ItemEnabled
, ItemSelected
, ItemNavigateUrl
, ItemRouteName
...) on the parent controls above.
<bs:DropDown Text="Very Simple Dropdown">
<bs:DropDownItem NavigateUrl="https://www.google.com/">
Google
</bs:DropDownItem>
<bs:DropDownItem NavigateUrl="https://github.com/riganti/dotvvm" Text="DotVVM" />
</bs:DropDown>
<bs:DropDown ButtonType="Link" >
<Content>
<bs:Icon Type="Calendar" />
<strong>Simple Dropdown</strong>
with custom toggle
</Content>
<bs:DropDownItem NavigateUrl="https://www.google.com/" Enabled="false">
Google
</bs:DropDownItem>
<bs:DropDownSeparator />
<bs:DropDownItem NavigateUrl="https://github.com/riganti/dotvvm">
DotVVM
</bs:DropDownItem>
</bs:DropDown>
<bs:DropDown Text="Drop up Button" DropDirection="DropUp">
<bs:DropDownItem NavigateUrl="https://www.google.com/">
Google is a <strong>search engine</strong>
</bs:DropDownItem>
<bs:DropDownItem NavigateUrl="https://github.com/riganti/dotvvm">
DotVVM
</bs:DropDownItem>
</bs:DropDown>
<p>IsCollapsed: {{value: Collapsed}}</p>
<bs:DropDown IsCollapsed="{value: Collapsed}" Text="Collapse test">
<bs:DropDownItem NavigateUrl="https://www.google.com">Google</bs:DropDownItem>
</bs:DropDown>
public class ViewModel : DotvvmViewModelBase
{
public bool Collapsed { get; set; }
}
Properties
Name | Type | Description | Notes | Default Value | |
---|---|---|---|---|---|
ClientIDMode | ClientIDMode | Gets or sets the client ID generation algorithm. |
attribute
static value
|
Static | |
DataContext | Object | Gets or sets a data context for the control and its children. All value and command bindings are evaluated in context of this value. The DataContext is null in client-side templates. |
attribute
bindable
|
null | |
Enabled | Boolean | Gets or sets whether the item in the dropdown menu should be enabled or disabled. |
attribute
static value
bindable
|
True | |
ID | String | Gets or sets the control client ID within its naming container. |
attribute
static value
bindable
|
null | |
IncludeInPage | Boolean | Gets or sets whether the control is included in the DOM of the page. |
attribute
bindable
|
True | |
NavigateUrl | String | Gets or sets the URL to navigate to when an item in the dropdown menu is clicked. |
attribute
static value
bindable
|
null | |
RouteName | String | Gets or sets the route name to navigate to when an item in the dropdown menu is clicked. |
attribute
static value
|
null | |
Selected | Boolean | Gets or sets whether an item in the dropdown menu is selected. |
attribute
static value
bindable
|
null | |
Template | ITemplate | Gets or sets the template to use for item in the dropdown menu. |
inner element
static value
default
|
null | |
Text | String | Gets or sets the text to display item in the dropdown menu. |
attribute
static value
bindable
|
null | |
UrlSuffix | String | Gets or sets a suffix to append to the URL for item in the dropdown menu. |
attribute
static value
bindable
|
null | |
Visible | Boolean | Gets or sets whether the control is visible. When set to false, `style="display: none"` will be added to this control. |
attribute
static value
bindable
|
True |
Events
Name | Type | Description | |
---|---|---|---|
Click | ICommandBinding | Gets or sets the command that will be triggered when item in the dropdown menu are clicked. |