Avalonia Issue
Im having an issue in my wordle clone with when i type with the onscreen keyboard then press the enter key it types the same character that you pressed. Its been giving me quite a bit of trouble. I have a relay command named Press() and it calls the typecharacter function. Im thinking that it is the problem but i cant see anything. https://github.com/NoahWeddles/Wordle-Clone
GitHub
GitHub - NoahWeddles/Wordle-Clone
Contribute to NoahWeddles/Wordle-Clone development by creating an account on GitHub.
23 Replies
Avalonia buttons can be pressed by using the enter key when focused: https://github.com/AvaloniaUI/Avalonia/blob/f42af483c9760dd2d164972b1ea8484dbeb36cfe/src/Avalonia.Controls/Button.cs#L300
ok ill assume thats it
at least, i think it needs focus to receive key down events
either way, that's likely the culprit
ok
how could i circumvent that
could always subclass
Button
and override both OnKeyDown
and OnKeyUp
to make it ignore all button presses so it only works with mouse clicks
not sure if that would cause any issues, but it would be very easy to testok
"subclassing" Button would entail creating a custom control for use in my xaml file right?
or am i misunderstanding you
just make a class that inherits from
Button
and override those two methods and make them do nothinga seperate file or within my MainWindowViewModel.cs
I personally do not put more than 1 class in a file
like this?

$tias
alr
ok

i have this
which from my logic should override the original function of the onkeydown event in the button class
ya
my issue is with using this class
how can i replace my <Button> s function with this?
by changing
<Button>
to <FixedButton>

its not working
probably need to make sure the correct namespace is imported
i don't use VS with avalonia, but rider always handles the imports for me
sec
xmlns:controls1="clr-namespace:Aggregator.UI.Dataset.Manager.Rewrite.Controls"
something like this (example from one of my avalonia projects)
which can be used like <controls1:YourControlName>
alright i have it figured out
tysm
:Ok:
:PepoSalute: