riganti / dotvvm

Open source MVVM framework for Web Apps
https://www.dotvvm.com
Apache License 2.0
743 stars 97 forks source link

Support for `datalist` control #1825

Open tomasherceg opened 4 months ago

tomasherceg commented 4 months ago

HTML allows specifying <datalist> component with a list of <option> elements. We should have a DataList control in DotVVM.

Since it does not have a concept of selected values, we cannot use the classes Selector or SelectorBase. However, we will need to have it the DataSource property and ItemTextBinding, which would extract the display value in case the data source contains a collection of objects.

Then, we can add the List property to the TextBox control, which would receive the ID of the associated DataList control, and do the trick. The usage would look like this:

<dot:TextBox Text="{value: Currency}" List="currencies" />
<dot:DataList ID="currencies" DataSource="{value: CurrencyList}" ItemTextBinding="{value: Code}" />