Search code examples
c#clickappearance

C# How to make another button appear by clicking a different button?


I want to click on a button and make a text block and another button appear. I managed to make the text block appear. How do I make the button appear. I can't seem to find a function that does so. Also, does it need to be a different private void statement. So far I have:

private void one_Click(object sender, RoutedEventArgs e)
{
    oneBlock.Text = "one";
}

private void one_Click(object sender, RoutedEventArgs e)
{
    one_Trans.ClickMode = "two";
}

Solution

  • You can do something like this:

    private void button1_Click(object sender, RoutedEventArgs e)
    {
        button2.Visibility = Visibility.Visible;
    }
    

    XAML:

    <Button x:Name="button2" Content="Button" Visibility="Collapsed"/>
    

    More here: http://msdn.microsoft.com/en-us/library/system.windows.visibility(v=vs.95).aspx