繁体   English   中英

I'm using Wpf C# and I have a couple of windows, how can I link code behind form one window to other code behind window

[英]I'm using Wpf C# and I have a couple of windows, how can I link code behind form one window to other code behind window

所以我想从我的主窗口中的文本框中获取一个值,并将其用于计算另一个 window 中的代码,我如何从主窗口输入中获取数据并将其用于另一个 window 后面的代码中

我建议阅读 MVVM 模式,这将帮助您以一种干净利落的方式实现这一目标。

However if you want a quick, dirty hack, just make a new Static Class somewhere with Static Properties like public static string Window1Text {get; set;} public static string Window1Text {get; set;}这应该从您的所有 windows 中都可见。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM