简体   繁体   English

Silverlight-通过可见性进行动态绑定

[英]Silverlight - Dynamic binding by visibility

If I have two text boxes, one is visible , other one isn't . 如果我有两个文本框,则一个可见 ,而另一个 可见 Both are bound to the same property. 两者都绑定到相同的属性。

Is there a way to bind only visible one? 有没有办法只绑定可见的? That way validation causes only one error in the Validation Summary ? 这样,验证只会在“ 验证摘要”中导致一个错误?

I have a form with many fiends but also many different ways people can enter data based on their selection. 我有一个表单,其中包含很多方面的知识,但是人们可以根据自己的选择输入数据的方式也多种多样。 So I was wondering if there is a way of maybe having a method that goes over all hidden components and disables validation or/and unbinds it temporarily . 所以我想知道是否有一种方法可以遍历所有隐藏组件并禁用验证或暂时取消绑定

Here's a nice short example of what you're trying to accomplish: http://blog.dotnetstep.in/2009/12/silverlight-3-enable-and-disable.html 这是您要完成的任务的简短示例: http : //blog.dotnetstep.in/2009/12/silverlight-3-enable-and-disable.html

You could use the visual tree walker in this example to walk the visual tree and remove the bindings on any framework elements who have a visibility value of collapsed: http://netpl.blogspot.com/2010/03/silverlight-visual-tree-walker.html 您可以在此示例中使用可视化树漫游器来遍历可视化树并删除可见性值为折叠的任何框架元素上的绑定: http : //netpl.blogspot.com/2010/03/silverlight-visual-tree -walker.html

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

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