How to hide Label or TextBlock inside a WPF Grid
31,715
Solution 1
Never mind, it does work when you run it, it was just the designer that does not display it correctly.
Solution 2
In Code you can use something like the following:
Label1.Visibility = Visibility.Hidden;
Solution 3
<TextBlock Visibility="Collapsed">
Solution 4
@Laxman Singhare you sure about Visibility.Hidden? It should be
this.TextBlock.Visibility = Visibility.Collapsed;
Author by
Admin
Updated on July 19, 2022Comments
-
Admin almost 2 years
I am trying to hide the TextBlock and Label which are placed inside a grid like so:
<TextBlock Grid.Column="3" Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Hidden">Text inside TextBlock</TextBlock> <Label Grid.Column="4" Grid.Row="2" HorizontalAlignment="Center" Visibility="Hidden">Text inside Label</Label>
But the text does not disappear. Any ideas why that is?
-
Admin about 15 yearsUPDATE: Damn, it does work when you run it, it was just the designer that does not display it correctly.
-
-
fedeteka about 6 yearsWorking solution!