Skip to content

[SOLVED] How to set focus on TextEdit component? #1778

Answered by stsrki
KroMignon asked this question in Q&A
Discussion options

You must be logged in to vote

Solution

<Button Outline="false" Disabled="EditMode" Clicked="@(() => OnTextEdit(true))">@buttonText</Button>

@if ( EditMode )
{
    <Row>
        <Column ColumnSize="ColumnSize.IsFull" Margin="Margin.Is2.OnY">
            <TextEdit @ref="textInput" @bind-Text="@currentEdit" />
            <Button Color="Color.Primary" Clicked="@(() => OnTextEdit(false))" Margin="Margin.Is2">Store</Button>
        </Column>
    </Row>
}
@code {

    [Parameter]
    public string UserAnswer { get; set; } = "";
    [Parameter]
    public EventCallback<string> UserAnswerChanged { get; set; }

    private bool EditMode = false;
    TextEdit textInput;

    string currentEdit = "";
    string buttonText = "___"

Replies: 5 comments 5 replies

Comment options

You must be logged in to vote
2 replies
@KroMignon
Comment options

@KroMignon
Comment options

Comment options

You must be logged in to vote
1 reply
@KroMignon
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@KroMignon
Comment options

@stsrki
Comment options

Answer selected by KroMignon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants