try
rctSquare1.Visibility = Visibility.Hidden;
Update
What about that?
rctSquare1.Opacity = 0;
题
I'm a very early coder and using c# for desktop to start off and I heard I could code for windows phone using c# but it is so different it makes my head spin.
How do I hide a rectangle called "rctSquare1"? I'm used to typing "rctSquare1.Hide();" but that doesn't work and I cant find any answers...
解决方案
try
rctSquare1.Visibility = Visibility.Hidden;
Update
What about that?
rctSquare1.Opacity = 0;
其他提示
Set one of the following Visibility
values on your element:
Setting it to Visibility.Hidden
will leave empty space in your window where the element was (similar to SomeControl.Hide()
in WinForms
.
Do not display the element, and do not reserve space for it in layout.
rect.Visibility = Visibility.Collapsed;
Alternatively, Visibility.Collapsed
will actually hide the element and collapse the empty space too. If your element is inside a grid, for example, then setting to Collapsed
will cause the row to collapse as well (as long as you aren't setting an explicit height on the row, and there aren't any other elements in the row preventing it from collapsing).
Do not display the element, but reserve space for the element in layout.
rect.Visibility = Visibility.Hidden;