Hello Ditchford,
Greetings from Syncfusion support.
We have checked your query. When the ‘Multiline’ property is set to true the SfTextBox acts as a TextArea. By default when a TextArea gets focused the cursor is placed at the end of the text, instead of selecting the entire text. However, you can still select the text in the SfTextBox, when it gets focused by using the javascript method ’Select’ of the input object in the focus event of the SfTextBox. This can be achieved by using JsInterop. Please refer the below code snippet.
Razor file:
<div>
<div>
<SfTextBox @ref="textObj" ID="multiline" Multiline="true" CssClass="e-outline" Placeholder="Outlined" FloatLabelType="@FloatLabelType.Always" Focus="textFocus"></SfTextBox>
</div>
</div>
@code{
[Inject]
protected IJSRuntime JsRuntime { get; set; }
SfTextBox textObj;
public async Task textFocus(FocusInEventArgs args)
{
await JsRuntime.InvokeVoidAsync("onTextFocus");
}
}
|
JS File:
window.onTextFocus = () => {
document.getElementById("multiline").select();
}
|
Please find the attached sample and revert for more queries.
Regards,
Joseph Christ Nithin I.