2020-08-10

WPF call global variable via App.Current.Properties[ObjKey]=ObjValue

1.New Wpf project;

2.Add New Wpf Window named SubWindow;

3.Set global vairable via App.Current.Properties[objKey]=objValue in MainWindow constructor.

 public MainWindow()  {   InitializeComponent();   App.Current.Properties["CurrentId"] = "FB8EA0F0-CC46-4A7F-8E95-697B04F543D1";   }

4.Invoke and call the assigned global variable in sub window constructor 

public SubWindow()  {   InitializeComponent();   MessageBox.Show(App.Current.Properties["CurrentId"].ToString());  }

5.In the MainWindow page,click the button and show the result.

private void Button_Click(object sender, RoutedEventArgs e)  {   SubWindow subWin = new SubWindow();   subWin.Show();  }

 

WPF call global variable via App.Current.Properties[ObjKey]=ObjValue关键词亚马逊产品差评处理&反跟卖hts亚马逊商品图片采集工具,有需要的可以去下载2019最权威亚马逊选品指南!亚马逊一周热点事件!从化响水峡自驾车如何安排呢?2017年哪里可以享受温泉之旅?龙门温泉旅游度假区怎样?德庆盘龙峡好玩吗?

No comments:

Post a Comment