如何在WPF中获取绑定到控件的属性的名称 [英] How to get the name of property bounded to a control in wpf

查看:78
本文介绍了如何在WPF中获取绑定到控件的属性的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的xaml文件中有一个文本框,其文本属性绑定到名为"Textvalue"的字符串peoperty.

后面的代码中是否有办法知道文本属性名称的边界? ..通过传递文本框对象????

I have a Textbox in my xaml file where its text property is bounded to the string peoperty called "Textvalue ".


Is there a way in code behind to know the text property name bounded ??
..by passing the textbox object????

推荐答案

BindingExpression be = BindingOperations.GetBindingExpression((FrameworkElement)yourComboBox, ((DependencyProperty)Button.SelectedItemProperty));
string Name = be.ParentBinding.Path.Path;


这篇关于如何在WPF中获取绑定到控件的属性的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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