查找在WPF中创建的文本框 [英] finding the textbox created in wpf

查看:93
本文介绍了查找在WPF中创建的文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi

我正在wpf中以(pricetxt)的名称动态创建文本框控件,现在我想找到该控件,并且想动态使用这些属性,因此,我想找到这些控件,我对此一无所知wpf,


通常在Windows中通过使用controls.find(...);
我们可以找到控件名称,但是在wpf中,我无法获得查找"之类的选项,因此我正面临问题,因此请帮助我
示例代码在这里


hi

i am creatin the the textbox control dynamically in wpf with name of(pricetxt), right now i want to find the control and i want to use the properties dynamically , so that , i want to find the controls, i dont have much idea about the wpf,


generally in windows by using the controls.find(...);
we can find the control name but , in wpf i am not able to get the option like "Find", so that i am facing the proble , so please help me
the sample code is here


TextBox tx= (TextBox ) this.partialpan.Children.


在这里我无法找到查找"选项,是否还有其他选择可以找到控件,请给我重播

非常感谢您的关注


here i am not able to get the Find option, is there any other option to find the control , please give me a replay

thank a lot for your attention

推荐答案

您为什么要加倍努力?

如果要动态创建它,为什么不坚持使用全局静态变量呢?这样,您可以从可能需要的任何位置访问它.

您是否给它分配了Name?如果是这样,则此链接中显示的代码应该可以工作:

http://www.c-sharpcorner.com/UploadFile/mahesh/FindName10022009122153PM/FindName.aspx [ ^ ]
Why are you making it hard on yourself?

If you''re creating it dynamically, why not just hold onto in in a global static variable? That way, you can access it from anywhere you might need to.

Did you assign it a Name? If so code like that shown at this link should work:

http://www.c-sharpcorner.com/UploadFile/mahesh/FindName10022009122153PM/FindName.aspx[^]


这篇关于查找在WPF中创建的文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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