Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

FluentUI: Capture KeyCode [Ctrl] + Mouseclick

$
0
0

I am using FluentUI for Blazor WASM in version 4.10.3.

I want to check if they key [Ctrl] is pressed when clicking on an element with my mouse.I registered builder.Services.AddFluentUIComponents(); in Program.cs and added <FluentKeyCodeProvider /> in my MainLayout.razror, all accoring to documentation: https://www.fluentui-blazor.net/KeyCode.

However I can only recognize if I press [Ctrl] with another key, e.g. [Ctrl]+[G]. A single [Ctrl] KeyDown isn't recognized. For example the following does not trigger, when just pressing [Ctrl]:

public async Task OnKeyDownAsync(FluentKeyCodeEventArgs args){    if (args.CtrlKey)    {        _logger.LogInformation("[Ctrl] was pressed.");    }}

How can I achieve to recognize if [Ctrl] is pressed, when clicking with my mouse (normal left click) anywhere on my page, e.g. on a div container?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>