1
Answer

Button Visibility Problems

blake welsh

blake welsh

14y
15.8k
1
Hello, 

just wondering if anyone would be able to help me out as i have a problem i cannot fix. i am relatively new to C# and am using visual studio 2010 to design a small program. The problem i am having is that i have 2 buttons, 1 that loads hidden and the other starts visible and i want them to change visibility when the visible button is clicked. i can get the hidden button to appear but i cannot for the life of me get the visible button to hide:
code is as below:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO.Ports;
using System.Threading;


namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>

    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {

        }
        private void button3_Click(object sender, RoutedEventArgs e)
        {
            
            EndDataButton.IsEnabled = true;
            EndDataButton.Visibility = 0;
            StartData.Visibility = 1;
            StartData.IsEnabled = false;
            
            Port();

        }

obviously it keeps going but that is the main code. there error is that no matter what i put into "startData.visibility" whether it be int, boolean whatever i cant get it to go hidden, if anyone can help that would be fantastic, it keeps talking about implicit conversion of type 'type' to 'System.Windows.Visibility' and it requires an explicit conversation but i have no idea what this is and how to fix the problem,

if you can help that would be fantastic.
Answers (1)