Created
April 23, 2020 23:20
-
-
Save SQL-MisterMagoo/6116024caa21f6037864ce2b375c2878 to your computer and use it in GitHub Desktop.
DoubleClickAndBlur
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table class="table-bordered"> | |
<tr> | |
<td @ondblclick="StartEdit"> | |
@if (Editing) | |
{ | |
<input @bind="Name" @onblur="EndEdit" /> | |
} | |
else | |
{ | |
<span>@(Name ?? "double-click here")</span> | |
} | |
</td> | |
</tr> | |
</table> | |
@code | |
{ | |
string Name; | |
bool Editing; | |
void StartEdit() => Editing = true; | |
void EndEdit() => Editing = false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment