What is the correct ternary operation here?
I cannot "assign" values in ternary operations?
28 Replies
ternary for assignment not comparison
but if you put inside ()
it could work i think
put right side of == in ()
Also you are complicating
Just use switch expression
to me it looks like you're trying to assing the wrong thing no?
When i look to your code
i dont get what you are trying to do
yeah
š
Application.Current.MainWindow.WindowState = WindowState.Minimize; ?
Yeah
But command is maximize command
Yeah that's what im trying to explain
It would be a MaximizeRestoreWindowCommand as is
anyway the problem is that his code and ternary are wrong like I pointed out
I guess this would be better?
more readable and they are separate
a command for each button
you could do that yes, and since the button is named Minimized and the other Maximize it would make more sense
yep, great š
Also what's the type of "o" ?
Maybe you can use that too
object
It's probably boxed to object
nvm just dont care then
š
hmm
you should look into using CommunityToolkit.Mvvm it will reduce and simplify a lot of your code
how can i check not
.Equals
?You could put "!" start of it
or simply "is not x"
Is this valid?
we would need to know what o is first, u would have to breakpoint and check its insides
since you're using a RelayCommand it might depend how it was setup and what its passing over
Looks like it's an action but im not so sure
You could just do this:
The check doesn't make much sense there
Problem is Command is MaximizeWindowCommand
so it should minimize