예제 #1
0
 /// <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();
     }
 }
예제 #3
0
 public void Focus()
 {
     if (FocusElement.Context != null)
     {
         FocusElement.FocusAsync();
     }
 }
예제 #4
0
 /// <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();
     }
 }
예제 #5
0
 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());
 }
예제 #6
0
        protected virtual async Task ClearButtonClickHandlerAsync(MouseEventArgs e)
        {
            await SetTextAsync(string.Empty, updateValue : true);

            await ElementReference.FocusAsync();

            await OnClearButtonClick.InvokeAsync(e);
        }
예제 #7
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (firstRender)
            {
                await Task.Delay(50);

                await _titleInput.FocusAsync();
            }
        }
예제 #8
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            await base.OnAfterRenderAsync(firstRender);

            if (setFocus)
            {
                await input.FocusAsync();

                setFocus = false;
            }
        }
예제 #9
0
        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
        }
예제 #12
0
        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;
            }
        }
예제 #13
0
 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);
     }
 }
예제 #14
0
 public ValueTask FocusAsync() => _elementReference.FocusAsync();
예제 #15
0
 /// <summary>
 /// Focuses the start input of MudRangeInput
 /// </summary>
 /// <returns></returns>
 public ValueTask FocusStartAsync() => _elementReferenceStart.FocusAsync();
예제 #16
0
 protected override async Task OnAfterRenderAsync(bool firstRender)
 {
     await LastNameInput.FocusAsync();
 }
예제 #17
0
 public void MostrarInfo(string dato)
 {
     InputTextRef.FocusAsync();
     Console.WriteLine(dato);
     StateHasChanged();
 }
예제 #18
0
 public override ValueTask FocusAsync()
 {
     return(_elementReference.FocusAsync());
 }
예제 #19
0
 private async Task InitializeFocus()
 {
     await beatButton.FocusAsync();
 }
 protected async override Task OnAfterRenderAsync(bool firstRender) => await LastNameInput.FocusAsync();
예제 #21
0
 /// <summary>
 /// Sets the focus on the input element.
 /// </summary>
 public async Task FocusAsync()
 {
     await input.FocusAsync();
 }
예제 #22
0
 /// <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);
예제 #23
0
 private void OnClick()
 {
     _ = inputEl.FocusAsync();
 }