Renders a ComboBox control similar to HTML <select> element.
AllowNewItem Boolean Gets or sets whether it is allowed to create new items from the entered text.
AllowUnselect Boolean Gets or sets whether the selected value can be unselected. The default value is true.
AutoFocus Boolean Gets or sets whether the control should have focus when page loads or when a dialog is opened. The default value is false.
Enabled Boolean Gets or sets whether the control is enabled and can be modified.
ItemEnabledBinding IValueBinding<Boolean?> Gets or sets the binding indicating whether a DataSource item can be selected.
ItemTextBinding IValueBinding<String> Gets or sets the binding which retrieves the text from a DataSource item. It retrieves the whole item by default.
ItemValueBinding IValueBinding Gets or sets the binding which retrieves a value from a DataSource property. It retrieves the whole item by default.
LoadItems ComboBox+LoadItemsFunc Gets or sets a function used to load additional items from server. For example, it is used to search for items on server-side.
LoadItemsMode LoadItemsMode Gets or sets how are items returned by the LoadItems command. They can either be merged with existing items in the DataSource; or they can replace them. The default value is Merge.
Placeholder String Gets or sets the text displayed when no item is selected (or when text is empty).
SelectedValue Object Gets or sets the value of the item selected by user.
TabIndex Int32 Gets or sets the order in which the control is reachable in sequential keyboard navigation. The default value is 0 which means the document order.
Text String Gets or sets the text value of the control (useful for searching or creating new items).
Changed Command Gets or sets the command that will be triggered when the text (or value) is changed.
This control is different from the built-in ComboBox and is not derived from it.
The Business Pack ComboBox control is a text field which suggests items to select. It can perform server search, use custom templates for the suggested items and let the user to add his own values which are not present in the DataSource collection.
The Business Pack includes a similar control called DropDownList which is not a text field and cannot be typed into, however the user can also select items from a list which appears after clicking into the control.
The DataSource property specifies a collection of strings. For each item in the collection, a list item is created.
When the DataSource collection is bound to a collection of objects, you may use the ItemTextBinding to specify, which property of the object in the collection will be displayed as a text of a particular list item.
The Placeholder property specifies the text which is displayed when no value is selected.
To display custom content in the list items, you can use the ItemTemplate property to declare a custom template for the list items.
To allow entering a custom value which is not present in the DataSource collection, you can use the AllowNewItem property.
The Text property contains the exact value the user entered in the text field.
This feature can be used only when the DataSource collection contains string values.
The LoadItems property can specify a command in the viewmodel which will return new items based on what the user types in the control. Typically, this method is used with the Static Command and the method should return a list of items, and you need to use the value of the Text property as an argument to the viewmodel method.
The method in the viewmodel performs the search and returns a collection of items. These items are either added to existing items in the DataSource collection or they replace the existing items. It depends on the LoadItemsMode property.
If you use the static command, don't forget to decorate the method with the AllowStaticCommand attribute.
In the future versions of DotVVM, there are plans to enhance the server search functionality with more features (e.g. REST API integration).
The ItemKeyBinding property must be used when the SelectedValue is not a primitive type (like string, int etc.). This property helps the control to uniquely identify the selected object.
ToggleIconCssClass represents an icon that opens the popup with list of available items. The default value is fa fa-chevron-down (FontAwesome).
UnselectIconCssClass represents an icon that allows the user to deselect the item. The default value is fa fa-close (FontAwesome).