[英]Pass Values from one user control to another
I am working on a WPF application, and I looking for a solution on how to pass a integer values either generated or pulled from a database across user controls我正在开发一个 WPF 应用程序,我正在寻找一种解决方案,说明如何通过用户控件从数据库中生成或提取 integer 值
For example例如
WinA
WinA
的主要 windowCustomerDetails
and another CustomerOrder
CustomerDetails
,另一个称为CustomerOrder
CustomerDetails
user control has a CustomerID
textbox and a button and some unimportant textboxes to insert values into the database CustomerDetails
用户控件有一个CustomerID
文本框和一个按钮以及一些用于将值插入数据库的不重要的文本框CustomerOrder
has an OrderID
textbox CustomerOrder
有一个OrderID
文本框We create a customer profile on CustomerDetails
.我们在
CustomerDetails
上创建客户资料。 When I click the button (on CustomerDetails
), it would not only save values to the database but also open the CustomerOrder
user control and should take the value from the CustomerID
textbox and pass it into the OrderID
textbox当我单击按钮(在
CustomerDetails
上)时,它不仅会将值保存到数据库中,还会打开CustomerOrder
用户控件,并且应该从CustomerID
文本框中获取值并将其传递到OrderID
文本框中
You can create a variable using get and set inside the code for the control.您可以在控件代码中使用 get 和 set 创建变量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.