BTesto<T> - esempi
Testo con binding
<BTesto BType="string"
Id="txtDescrizione"
DataType="BTesto<string>.eDataType.Alfanumerico"
TextFormat="BTesto<string>.eTextFormat.MAIUSCOLO"
MaxLength="100"
Placeholder="Descrizione"
@bind-Value="modello.Descrizione" />
Valuta nullable
<BTesto BType="double?"
Id="txtImporto"
DataType="BTesto<double?>.eDataType.Valuta"
NumDec="2"
ValutaAcceptNULL="true"
@bind-Value="modello.Importo" />
Scegliere T coerente con la proprietà del modello e usare BConvert nelle conversioni esterne al binding.
Data con calendario e help button
<BTesto BType="DateTime?"
Id="txtDataConsegna"
DataType="BTesto<DateTime?>.eDataType.Data"
HelpButton="true"
ActiveCalendarOnHelpButton="true"
TextHelpButton="📅"
OnHelpButtonClick="CalendarioAperto"
@bind-Value="modello.DataConsegna" />
Autocomplete con codice e descrizione
<BTesto BType="string"
Id="txtComune"
DataType="BTesto<string>.eDataType.Alfanumerico"
AutoComplete="true"
AutoCompleteMinLength="2"
AutoCompleteDelay="300"
AutoCompleteCheckValue="true"
AutoCompleteSearch="CercaComuni"
AutoCompleteGetItem="CaricaComune"
@bind-Value="descrizioneComune"
@bind-AutoCompleteValue="idComune" />
private Task<List<BItem>> CercaComuni(string text)
{
return servizioComuni.Cerca(text);
}
private Task<BItem?> CaricaComune(string id)
{
return servizioComuni.Carica(id);
}
Value contiene il testo/descrizione visualizzato; AutoCompleteValue contiene il codice del BItem selezionato.
Configurazione dopo il rendering
await testo.SetDataType(BTesto<double?>.eDataType.Valuta);
await testo.SetNumDec(3);
await testo.SetValutaAcceptNULL(true);
await testo.SetCtlNextFocus("txtNote");
await testo.SetFocus();
Usare i metodi Set* quando il cambiamento deve aggiornare anche l'interop JavaScript già inizializzato.
