简体   繁体   English

将数据从View传输到复杂控件的最佳方法

[英]Best way to transfer data from View to complex controls

I am building a control heavy application in wpf and I am trying use the best solution for various views (in terms of maintainability, scalability, etc). 我正在wpf中构建一个控制繁重的应用程序,并且我尝试针对各种视图(就可维护性,可伸缩性等)使用最佳解决方案。

Eg If I have a control on a main view and I want to bind data between them I use a dependency property. 例如,如果我在主视图上有一个控件,并且想在它们之间绑定数据,则可以使用依赖项属性。

My question is what is the best tool to use if I have a control (lets call it PaneControl) on a view (call it MainView), which itself contains a control (call it BasicControl) with a property on it which I want to pass to the main view. 我的问题是,如果我在视图(称为MainView)上有一个控件(叫它PaneControl),它本身包含一个控件(称它为BasicControl),并且它具有要传递的属性,那么使用的最佳工具是什么?到主视图。

Is there a way of passing the property from the BasicControl to the MainView without sending a command to PaneControl and then sending another command to MainView? 有没有一种方法可以将属性从BasicControl传递到MainView,而无需将命令发送给PaneControl,然后再将另一个命令发送给MainView?

Best way to transfer data from view to complex controls would be still Binding ElementName. 从视图向复杂控件传输数据的最佳方法仍然是Binding ElementName。

Here is a link to a page that explains how to use Binding ElementName. 这是指向页面的链接,该页面解释了如何使用绑定ElementName。

http://msdn.microsoft.com/en-us/library/system.windows.data.binding.elementname%28v=vs.110%29.aspx http://msdn.microsoft.com/zh-cn/library/system.windows.data.binding.elementname%28v=vs.110%29.aspx

If ElementName is not what you looking for then maybe x:Reference will help you out. 如果不是您想要的ElementName,那么x:Reference可能会帮助您。

Take a look at this link: 看一下这个链接:

http://msdn.microsoft.com/en-us/library/ee795380%28v=vs.110%29.aspx http://msdn.microsoft.com/zh-CN/library/ee795380%28v=vs.110%29.aspx

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

相关问题 将数据从视图传输到javascript的最佳方式 - Best way to transfer data from view to javascript 将数据合同从服务转移到消费者的最佳方法 - Best way to transfer data contract from service to consumer 将数据从SqlDataReader传输到List的最佳方法是什么 <SomeClass> ? - What is the best way to transfer data from SqlDataReader into List<SomeClass>? 在SQL Server之间传输数据的最佳方法 - Best way to transfer data between SQL Servers "将数据从视图传输到控制器" - transfer data from view to controller 使用C#在MS SQL Express 05中将数据从一个数据库传输到另一个数据库的最佳方法 - best way to transfer data from one database to other in ms sql express 05 using c# 从WCF中检索数据表而不使用数据传输对象的最佳方法是什么 - what is the best way to retrieve a datatable from WCF without using Data transfer objects 将选项数据从一种形式转移回主形式的最佳方法 - Best way to transfer option data from one form back to the main form 在Xamarin中将数据从一个视图传递到另一个视图的最佳方法是什么? - What is the best way to pass data from one View to another in Xamarin? 如何从Asp.Net MVC中的复杂视图中最佳检索数据 - How to best retrieve data from a complex view in Asp.Net MVC
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM