I am new to WPF. I have a window with multiple buttons. I would like to hide all buttons in the window except for one. Buttons are added to the window dynamically.
XAML Code:
<Grid>
<Button x:Name="btnA"/>
<Button x:Name="btnB" />
<Button x:Name="btnC"/>
<Button x:Name="btnD" />
<Button x:Name="btnE"/>
<Button x:Name="btnF" />
<Button x:Name="btnG"/>
<Button x:Name="btnH" />
<StackPanel >
<Button x:Name="btnHideAllButtons" click="btnHideAllButtons_Click"/>
</StackPanel>
</Grid>
C# Code
private void btnHideAllButtons_Click(object sender, RoutedEventArgs e)
{
//Code to Hide all Buttons
btnHideAllButtons.Visibility = Visibility.Visible;
}