Clyde Eisenbeis

Clyde Eisenbeis

  • 1.3k
  • 63
  • 11.8k

How do I hide the gBuOk Button?

Mar 25 2024 11:04 PM

C# wpf - A xaml has these buttons:

<Button x:Name="gBuYes" 
                Content="Yes" 
                Margin="0,10,0,0" 
                Width="100"
                HorizontalAlignment="Center" 
                Visibility="Visible"
                Click="gBuYes_Click" />
<Button x:Name="gBuOk" 
                Content="Ok" 
                Margin="10,10,10,0" 
                Width="100"
                HorizontalAlignment="Center" 
                Visibility="Visible"
                Click="gBuOk_Click" />
<Button x:Name="gBuNo" 
                Content="No" 
                Margin="0,10,0,0" 
                Width="100"
                HorizontalAlignment="Center" 
                Visibility="Visible"
                Click="gBuNo_Click" />

In the xaml.cs code, to hide the gBuOk Button, this does not work:

this.gBuOk.Visibility = "Hidden";

How do I hide the gBuOk Button?


Answers (3)