簡體   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