C
C#2y ago
Dawnbomb

❔ how can WPF change the hover mouseover color of something like Winforms can?

I'm getting increasingly frustrated at how many features WPF is just lacking compared to winforms, and i feel like this is my breaking point. I've googled all over, but how can WPF forms change the color of something on mouseover? Unlike winforms, it seems to do it by default, with no way to disable it or change the color it changes to, without a ton of code. Is there anyway at all to change it in a simple way, or do i really have to do the unreasonable and write multiple paragraphs of code per button/element on a form for something that should just be 1 button click. HELP DX
15 Replies
binstarjs
binstarjs2y ago
you can use triggers that trigger when IsMouseOver property is set to true. related question about mouseover change color of button, haven't read it thoroughly yet but i hope you'll get the answer there https://stackoverflow.com/questions/20073294/change-color-of-button-when-mouse-is-over
Stack Overflow
Change color of Button when Mouse is over
I want to change the background color of a button when IsMouseOver == True <Button Command="{Binding ClickRectangleColorCommand}" Background="{Binding Color, Converter={StaticResource
binstarjs
binstarjs2y ago
i have watched this tutorial a few months back and you could watch it too in case you don't know what a trigger is https://www.youtube.com/watch?v=kc5MapV54e0
DotNetSkoool
YouTube
Triggers in WPF
Hi My fellow learners, since you have learnt about Styles it is time to look into WPF triggers. Triggers are used with styles to give your UI a rich and dynamic look and feel. Leave a comment for your doubts and please do subscribe to my channel. Share this channel and keep learing.
Dawnbomb
Dawnbomb2y ago
yes, its a video that shows how it takes several minutes for something winforms can do in 2 seconds hense my question, is there a way for it to not take forever
binstarjs
binstarjs2y ago
mhm, i dont know much about winforms but wpf is very flexible because u are using XAML to do such UI related task
Dawnbomb
Dawnbomb2y ago
also, mouse over isn't a property my experience with it is, "flexable" means "do everything 5~20x longer" and its making me not want to use it and im really trying to give it a chance but every fucking thing a user would want to do is made so god damned hard, unintuitive, and in the most time wasting way possible. like this question itself, why can't i just change the color, why do i need to code so much for something thats normally in a options menu in any other builder
binstarjs
binstarjs2y ago
i can understand, i was there. First time i learn a new so called concept MVVM just makes me question "why the hell should i do something that does exaclty same for 10 times much slower in terms of development time". As time pass, now i embrace that concept and never look back either be patience and enjoy the learning progress or yeah...
Dawnbomb
Dawnbomb2y ago
the top voted comments from your link are exactly my feelings
Dawnbomb
Dawnbomb2y ago
binstarjs
binstarjs2y ago
i agree
Dawnbomb
Dawnbomb2y ago
while im at it is there any other modern simple builders like winforms
binstarjs
binstarjs2y ago
haven't develop a GUI desktop application myself for long time so ¯\_(ツ)_/¯ i have heard another framework called avalonia, which is similar to wpf but never tried myself
Dawnbomb
Dawnbomb2y ago
just checked it out, it looked like it borderline not even a visual builder. RIP.
Alexicon
Alexicon2y ago
It's kind of funny because this was exactly my sentiment when I started using wpf coming from winforms but now several years later I could never return to winforms from wpf. Although it may seem like a hassle to do something seemingly trivial it's simply a result of allowing an enormous amount of flexibility which is necessary for large applications. It for sure takes longer if you are just trying to spin up a quick application but if you are working on a significantly large enough project the ability to style elements to the nth degree is required. All of this to say I would perhaps give it a chance if you have the patience. I would maybe look into things like styles, triggers and control templates which will allow you to make any control look like and do whatever you want. But at the end of the day you should use the tools that work best for you and maybe wpf isn't that
binstarjs
binstarjs2y ago
exactly. Been using winforms to create short project, then introduce myself to wpf, struggling to use it than winform, and now after been patiently adapting myself to the learning curve of wpf, i never looked back to winform
Accord
Accord2y ago
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.