❔ AvaloniaUI detect when TextBox's content is changed
yeah so how do i do that, apparently there is something for it but i can't seem to quite find how to use it
29 Replies
In your View.axaml you can name the Textbox like this
and in your code-behind you can subscribe to property changes with something like this
What you end up getting in my example is:
Thats how it should look like?
Cuz i got it work i think but idk if its becaused i used jetbrains rider but the structure is different
is how it looks for me (i know the indent but idk how to indent with this ide)
You were asking for a TextBox, thats a Button
The last one isn't
I just haven't figured out how to properly do my thing
oh, you want those bindings
I am trying to color text but only certain keywods, i kown i can color words with the avalonia but it doesn't seem to be able to highlight only some of them
is it better or worst?
They're kinda winforms-ey but I can write up some code for you to do that. What are the names of those controls that need to have OnPointerEnter and OnTextChangeHasChanged?
Well wdym, you gon re-write it for me?
Wait, this aint avalonia is it?
It is
For a sec I thought it wasnt cuz of your : UserControl
um, could u show your .axam code?
Well here's the buttons and textbox from my thing but beware, i am still testing i just began to use it and i just began to use c# this is just testing
so if its terrible pelase don't freak out, i don't know the in and outs yet
And which controls do u want bound to these?
Good question for the OnPointerEnter
I have no idea how it got there
Prob a bad copy past from SO
lol ok I can do the
one for you
I mean sure but all i really want is to give colors to certain words
I don't think that TextChanged is a property since its not showing up in mine so I will just change some stuff in there
Then your MainView's constructor becomes
and the OnTextChangeHasChanged becomes
Got it, but i am still curious about a method to color specific text only
hmm, im not sure about that one, i'll go check if thats possible (You mean like abc, then a is something like red, b is green, c is blue?)
exactly
trinna make highliting for smt
Cannot resolve symbol 'OnTextChangeHasChanged' btw
Could you show the .cs file contents?
Seems possible, just insanely user-unfriendly
https://github.com/AvaloniaUI/Avalonia/blob/master/samples/ControlCatalog/Pages/TextBlockPage.xaml
from the sample
i prob have too much using
dear mother of god what is this you sent me, HELL NAW
you ddnt add the method
Ah i see
Good
Well thanks
I believe this could be simplified like so:
I am aware of that, but my preference was the WhenValueachanged one xD
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.