【深入浅出WPF】——WPF
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.Windows;
5 using System.Windows.Controls;
6 using System.Windows.Data;
7 using System.Windows.Documents;
8 using System.Windows.Input;
9 using System.Windows.Media;
10 using System.Windows.Media.Imaging;
11 using System.Windows.Shapes;
12
13 namespace WpfApplication1
14 {
15 /// <summary>
16 /// Interaction logic for MainWindow.xaml
17 /// </summary>
18 public partial class MainWindow : Window
19 {
20 public MainWindow()
21 {
22 InitializeComponent();
23 }
24
25 private void button1_Click(object sender, RoutedEventArgs e)
26 {
27 string savedButton = System.Windows.Markup.XamlWriter.Save(this.button1);
28 textBox1.Text = savedButton;
29 }
30 }
31 }
32
2 using System.Collections.Generic;
3 using System.Text;
4 using System.Windows;
5 using System.Windows.Controls;
6 using System.Windows.Data;
7 using System.Windows.Documents;
8 using System.Windows.Input;
9 using System.Windows.Media;
10 using System.Windows.Media.Imaging;
11 using System.Windows.Shapes;
12
13 namespace WpfApplication1
14 {
15 /// <summary>
16 /// Interaction logic for MainWindow.xaml
17 /// </summary>
18 public partial class MainWindow : Window
19 {
20 public MainWindow()
21 {
22 InitializeComponent();
23 }
24
25 private void button1_Click(object sender, RoutedEventArgs e)
26 {
27 string savedButton = System.Windows.Markup.XamlWriter.Save(this.button1);
28 textBox1.Text = savedButton;
29 }
30 }
31 }
32