UWP将GetBindingExpression与x:Bind结合使用 [英] UWP Using GetBindingExpression with x:Bind

查看:47
本文介绍了UWP将GetBindingExpression与x:Bind结合使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的UWP应用程序从Binding重写为x:Bind.我在不同的文本框中有一个TextChanged事件.通过绑定,我可以使用GetBindingExpression来更新模型.x:Bind有等效的Methode吗?或者我怎么用x:Bind做到?

I am rewrite my UWP Application from Binding to x:Bind. I have a TextChanged Event on different Textboxes. With Binding I could use GetBindingExpression to update the Model. Is there an equivalent Methode for x:Bind? Or how could I make it with x:Bind?

    public void TextBox_TextChanged(object sender, TextChangedEventArgs e)
    {
        var binding = ((TextBox)sender).GetBindingExpression(TextBox.TextProperty);
        binding.UpdateSource();
    }

推荐答案

我曾经尝试过这样做,但没有成功.我认为暂时不可用,因为绑定只是标记扩展.这是文档和使用示例 https://msdn.microsoft.com/en-us/library/windows/apps/mt204783.aspx

I've tried to do this before without success. I think is not available for now, because Bind it's just a markup extension. Here is the documentation and examples how to use it https://msdn.microsoft.com/en-us/library/windows/apps/mt204783.aspx

这篇关于UWP将GetBindingExpression与x:Bind结合使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆