So I'm coding a Hang Man game. I've done it with WPF already and now trying with Xamarin. In WPF, I figured out a smart way to show the correct guessed letters:
So I go through every Label in this StackLayout
and I look if the label's content is equal to the triedLetter
. If so, I set the label to visible.
Btw. the method to give each label a letter from the word:
On Xamarin, this happens:
wordToGuess = test
every Label: ----
triedLetter: t -> StackLayout: Tt--
triedLetter: s -> StackLayout: Tst-
triedLetter: e -> StackLayout: Test
On my wpf project it looked like this:
wordToGuess = test
every label: ----
triedLetter: t -> StackLayout: T--t
triedLetter: s -> StackLayout: T-st
triedLetter: e -> StackLayout: Test
Any idea why? Seems like StackLayout
s are acting different from StackPanel
s on WPF.
And yes, I know there are some questions about the same topic, but they're doing it differently. And before I take someone else's idea, I like to solve my way instead.
Solve :
Instead of label.IsVisible = true/false
, I used label.Opacity = 0/100
Thanks to Skin for the solution !