Answer the question
In order to leave comments, you need to log in
How to hide buttons on click in WPF?
There are 4 buttons with visible:hide and 4 buttons that are in the same place are visible. When you click OK, the invisible ones should become visible. I don't know how to implement.
Isn't there something like css, where the tags are given the same classes, then this class is given common properties?
Answer the question
In order to leave comments, you need to log in
Place buttons in a container and change the visibility status of the container:
<Button Content="Ok" HorizontalAlignment="Left" VerticalAlignment="Top"
Width="75" Margin="0,75,0,0"
Click="Button_Click"
/>
<WrapPanel Name="Buttons" Orientation="Horizontal">
<Button Name="Button1" Content="Button" HorizontalAlignment="Left"
VerticalAlignment="Top" Width="75"
/>
<Button Name="Button2" Content="Button" HorizontalAlignment="Left"
VerticalAlignment="Top" Width="75"
/>
<Button Name="Button3" Content="Button" HorizontalAlignment="Left"
VerticalAlignment="Top" Width="75"
/>
<Button Name="Button4" Content="Button" HorizontalAlignment="Left"
VerticalAlignment="Top" Width="75"
/>
</WrapPanel>
private void Button_Click(object sender, RoutedEventArgs e)
{
Buttons.Visibility = Visibility.Hidden; // Visibility.Visible
/*
if (Buttons.Visibility == Visibility.Hidden)
{
Buttons.Visibility = Visibility.Visible;
}
else
{
Buttons.Visibility = Visibility.Hidden;
}
*/
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question