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; namespace WpfApplication1 { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { Boolean clicked = true; public MainWindow() { InitializeComponent(); border1.Background = SystemColors.GrayTextBrush; String str1 = "My label"; String str2 = border1.Width.ToString(); label1.Content = str1; } private void button1_Click(object sender, RoutedEventArgs e) { if (clicked == true) { label1.Content = "You Clicked a Button"; border1.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; clicked = false; } else { label1.Content = "Are you trying toggle"; border1.Background = Brushes.FloralWhite; border1.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; clicked = true; } } } }