1.构造函数

2.静态变量

3.增加窗体属性

public string name{set;get;}

例如:

 public partial class Window1 : Window
    {
        public string  name { get; set; }
        public int age { get; set; }
        public Window1()
        {
            InitializeComponent();
        }
    }

传值:

 private void Button_Click(object sender, RoutedEventArgs e)
        {
            Window1 win = new Window1();
            win.name = "xiaohuang";
            win.age = 18;
            win.Show();
        }

 

令附快捷建立属性方法,使用代码片段1:简单属性,prop

                                                 2:完整属性:propfull

 

然后按两次Tab完成,再按Tab改类型,再按Tab改属性名。

4.使用Application.Current.Properties

传值方式:
//赋值:
Application.Current.Properties["bbb"] = "dsfds";

//取值:
  string aa = Application.Current.Properties["bbb"].ToString();

 

  

相关文章:

  • 2021-05-24
  • 2021-05-07
  • 2022-12-23
  • 2021-12-23
  • 2021-07-04
  • 2021-12-19
  • 2021-09-05
猜你喜欢
  • 2021-07-07
  • 2021-09-14
  • 2021-09-07
  • 2022-12-23
  • 2021-10-17
  • 2021-09-21
相关资源
相似解决方案