RinggoYao 发表于 2013-1-2 23:15:23

Silverlight:UpdateSourceTrigger属性的应用

<div id="cnblogs_post_body">      在Silverlight/WPF的BindingExpression中,我们可以对一个Bind定义UpdateSourceTrigger属性,但是在Silverlight里只提供了显式更新和默认方式(即失去焦点时触发),
所以如果我们需要TextBox在输入时即进行数据源的更新,我们需要进一步处理一下,那么如果你熟悉这个功能的话,你在网上能很快搜索出来类似下面的Code:
<div id="codeSnippetWrapper"> <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 99.85%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; height: 95px; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">TextBox txt = sender as TextBox;var bindingExpression = txt.GetBindingExpression(TextBox.TextProperty);if (bindingExpression != null){    bindingExpression.UpdateSource();}
页: [1]
查看完整版本: Silverlight:UpdateSourceTrigger属性的应用