/// <summary> /// Sets the focus trap. /// </summary> /// <returns>A task that represents the asynchronous operation.</returns> public async Task SetFocus() { if (Rendered) { if (HasFocusableComponents) { await HandleFocusableComponent(); } else { await startFirstRef.FocusAsync(); } } }
protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { await SearchInput.FocusAsync(); } }
public void Focus() { if (FocusElement.Context != null) { FocusElement.FocusAsync(); } }
/// <summary> /// Handles the focus end event. /// </summary> /// <param name="args">Supplies information about a focus event that is being raised.</param> /// <returns>A task that represents the asynchronous operation.</returns> protected virtual async Task OnFocusEndHandler(FocusEventArgs args) { if (shiftTabPressed) { await endFirstRef.FocusAsync(); } }
internal static ValueTask FocusAsyncWithWarning(this ElementReference element, string parentName) { if (element.Id == null) { Console.WriteLine("Warning! {0} passed default ElementReference to FocusAsync", parentName); } return(element.FocusAsync()); }
protected virtual async Task ClearButtonClickHandlerAsync(MouseEventArgs e) { await SetTextAsync(string.Empty, updateValue : true); await ElementReference.FocusAsync(); await OnClearButtonClick.InvokeAsync(e); }
protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { await Task.Delay(50); await _titleInput.FocusAsync(); } }
protected override async Task OnAfterRenderAsync(bool firstRender) { await base.OnAfterRenderAsync(firstRender); if (setFocus) { await input.FocusAsync(); setFocus = false; } }
public async void Search() { var products = await ProductService.SearchProducts(SearchModel.SearchText); Products = products.Select(p => { return(new SelectableProduct(p) { }); }).ToList(); StateHasChanged(); SearchInputControl.FocusAsync(); }
//send initial text (if supplied) to javascript to place in the div protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { await _JSRuntime.InvokeAsync<string>("BlazorContentEditable", _id, DotNetObjectReference.Create(this), Value); } if (Element.Focus) { Element.Focus = false; await _elementRef.FocusAsync(); } }
public static async Task FocusAsync(this IJSRuntime jSRuntime, ElementReference target, bool preventScroll = false) { #if NET6_0_OR_GREATER await target.FocusAsync(preventScroll); #else try { await jSRuntime.InvokeVoidAsync(JSInteropConstants.Focus, target, preventScroll); } catch (Exception e) { Console.WriteLine(e); throw; } #endif }
protected override async Task OnAfterRenderAsync(bool firstRender) { await base.OnAfterRenderAsync(firstRender); if (!isInitialized) { await BlurContainer.FocusAsync(); if (ModalModel.Options.Draggable) { await TablerService.SetElementProperty(dragContainer, "draggable", true); await TablerService.DisableDraggable(dragContainer, contentContainer); } isInitialized = true; } }
public override async ValueTask FocusAsync() { try { if (InputType == InputType.Hidden && ChildContent != null) { await _elementReference1.FocusAsync(); } else { await ElementReference.FocusAsync(); } } catch (Exception e) { Console.WriteLine("MudInput.FocusAsync: " + e.Message); } }
public ValueTask FocusAsync() => _elementReference.FocusAsync();
/// <summary> /// Focuses the start input of MudRangeInput /// </summary> /// <returns></returns> public ValueTask FocusStartAsync() => _elementReferenceStart.FocusAsync();
protected override async Task OnAfterRenderAsync(bool firstRender) { await LastNameInput.FocusAsync(); }
public void MostrarInfo(string dato) { InputTextRef.FocusAsync(); Console.WriteLine(dato); StateHasChanged(); }
public override ValueTask FocusAsync() { return(_elementReference.FocusAsync()); }
private async Task InitializeFocus() { await beatButton.FocusAsync(); }
protected async override Task OnAfterRenderAsync(bool firstRender) => await LastNameInput.FocusAsync();
/// <summary> /// Sets the focus on the input element. /// </summary> public async Task FocusAsync() { await input.FocusAsync(); }
/// <summary> /// Gives focus to an element given its <see cref="ElementReference"/>. /// </summary> /// <param name="elementReference">A reference to the element to focus.</param> /// <returns>The <see cref="ValueTask"/> representing the asynchronous focus operation.</returns> public static ValueTask FocusAsync(this ElementReference elementReference) => elementReference.FocusAsync(preventScroll: false);
private void OnClick() { _ = inputEl.FocusAsync(); }