Class InputDialogViewModel<T>
- Namespace
- Dmnk.Blazor.Dialogs.DefaultDialogs
- Assembly
- Dmnk.Blazor.Dialogs.dll
This dialog will ask the user for a single input value of type T, and optionally Validate it.
public class InputDialogViewModel<T> : SimpleDialogViewModelBase, IVmDialogViewModel, INotifyPropertyChanged
Type Parameters
TMust be one of int, string, double, DateTime.
- Inheritance
-
SimpleViewModelBaseSimpleDialogViewModelBaseInputDialogViewModel<T>
- Implements
- Inherited Members
Constructors
InputDialogViewModel()
See InputDialogViewModel<T>. Checks that the type parameter is valid.
public InputDialogViewModel()
Properties
ActionCancelText
The text shown on the cancel button. Defaults to "Cancel".
public string ActionCancelText { get; init; }
Property Value
ActionConfirmText
The text shown on the confirmation button. Defaults to "OK".
public string ActionConfirmText { get; init; }
Property Value
CloseCommand
Close the dialog, but only if ValidationError is null.
public SimpleAsyncRelayCommand CloseCommand { get; }
Property Value
- SimpleAsyncRelayCommand
Validate
An optional validation function that takes the current input value and returns an error message if the value is invalid, or null if the value is valid. If this function is set, the dialog will only allow closing with the confirmation button if the input value is valid. The error message can be displayed in the view by binding to the ValidationError property.
public Func<T?, string?>? Validate { get; init; }
Property Value
ValidationError
Returns the current validation error, if any. See Validate.
public string? ValidationError { get; }
Property Value
Value
The actual data input by the user. See type parameter T.
public T? Value { get; set; }
Property Value
- T