diff --git a/src/MatBlazor.Demo/Demo/DemoMatTextField.razor b/src/MatBlazor.Demo/Demo/DemoMatTextField.razor index 9f69d8c4..59849ca6 100644 --- a/src/MatBlazor.Demo/Demo/DemoMatTextField.razor +++ b/src/MatBlazor.Demo/Demo/DemoMatTextField.razor @@ -1251,6 +1251,55 @@ bool? boolNullValue; } + ")> + + + + +
Bind Event
+ + + + + +

+ + Value: @MyString11 +

+ +

+ + Value: @MyString12 +

+ + @code + { + public string MyString11 { get; set; } + public string MyString12 {get;set;} + } + +
+ + + + Value: @MyString11 +

+ +

+ + Value: @MyString12 +

+ + @code + { + + public string MyString11 {get;set;} + public string MyString12 {get;set;} + } + ")>
\ No newline at end of file diff --git a/src/MatBlazor/Components/MatTextField/BaseMatInputTextComponent.cs b/src/MatBlazor/Components/MatTextField/BaseMatInputTextComponent.cs index a0c9417f..57cbbf72 100644 --- a/src/MatBlazor/Components/MatTextField/BaseMatInputTextComponent.cs +++ b/src/MatBlazor/Components/MatTextField/BaseMatInputTextComponent.cs @@ -94,6 +94,11 @@ protected virtual bool InputTextReadOnly() [Parameter] public string Type { get; set; } = "text"; + [Parameter] + public bool UpdateOnInput { get; set; } + + protected string BindEvent => UpdateOnInput ? "oninput" : "onchange"; + protected virtual EventCallback OnKeyDownEvent() { diff --git a/src/MatBlazor/Components/MatTextField/MatInputTextComponent.razor b/src/MatBlazor/Components/MatTextField/MatInputTextComponent.razor index 3c1b5840..36ba3f3e 100644 --- a/src/MatBlazor/Components/MatTextField/MatInputTextComponent.razor +++ b/src/MatBlazor/Components/MatTextField/MatInputTextComponent.razor @@ -16,11 +16,11 @@ @if (TextArea) { -